Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails if quarkus-oidc-client is not in the classpath #824

Closed
ricardozanini opened this issue Oct 16, 2024 · 21 comments · Fixed by #829 or #872
Closed

Build fails if quarkus-oidc-client is not in the classpath #824

ricardozanini opened this issue Oct 16, 2024 · 21 comments · Fixed by #829 or #872
Assignees
Labels
area:client This item is related to the client extension bug Something isn't working

Comments

@ricardozanini
Copy link
Member

As part of the build generation introduced in #795, the latest release now breaks projects that are not using OIDC:

[ERROR] Failed to execute goal com.redhat.quarkus.platform:quarkus-maven-plugin:3.8.4.redhat-00002:build (default) on project openapi-bug: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkiverse.openapi.generator.deployment.GeneratorProcessor#additionalBean threw an exception: java.lang.NoClassDefFoundError: io/quarkus/oidc/client/runtime/AbstractTokensProducer
[ERROR]         at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[ERROR]         at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:508)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
[ERROR]         at io.quarkiverse.openapi.generator.deployment.GeneratorProcessor.additionalBean(GeneratorProcessor.java:72)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:569)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:840)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.ClassNotFoundException: io.quarkus.oidc.client.runtime.AbstractTokensProducer
[ERROR]         at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
[ERROR]         at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:225)
[ERROR]         at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:210)
[ERROR]         at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:205)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:518)
[ERROR]         at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468)
[ERROR]         ... 16 more
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

This openAPI spec doesn't even have security tags, so all the authz classes should be skipped and not generated.

@ricardozanini ricardozanini added bug Something isn't working area:client This item is related to the client extension labels Oct 16, 2024
@ricardozanini
Copy link
Member Author

@rmanibus, since you introduced this feature, do you mind taking a look and fixing it if possible?

@rmanibus
Copy link
Contributor

Sure !

@ricardozanini
Copy link
Member Author

@rmanibus do you have an estimate when you can take a look at it?

@rmanibus
Copy link
Contributor

rmanibus commented Oct 23, 2024

I tried to poke around already, I think I have a solution but I am still trying to find a way to test it. I am not sure how I could remove an extension for a specific test.
I meant to ask this on zulip, but if you have an idea I am all ears !

@ricardozanini
Copy link
Member Author

You can create a new integration test without the OIDC Client, and you will be able to reproduce this error. Then in the test case, you can just check if the Authz files were not generated.

@rmanibus
Copy link
Contributor

I tried that already, but the oidc extension is included in the parent pom, and there is no way to exclude it

@ricardozanini
Copy link
Member Author

@rmanibus
Copy link
Contributor

yes

@vhuc
Copy link

vhuc commented Nov 12, 2024

Il still have an issue with 2.6.0 and 2.6.0-lts linked, i think, with oidc client. I have this warning and after that, the test is blocked indefinitely :
2024-11-12 11:32:43,404 WARN [io.qua.arc.pro.BeanArchives] (build-41) Failed to index io.quarkus.oidc.client.runtime.AbstractTokensProducer: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: TEST for NameTest (QuarkusTest)@39329d81

@rmanibus
Copy link
Contributor

Could you provide a reproducer ?

@oben01
Copy link
Contributor

oben01 commented Nov 13, 2024

Same issue here
WARN [io.qua.arc.pro.BeanArchives] (build-51) Failed to index io.quarkus.oidc.client.runtime.AbstractTokensProducer: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: TEST for AskRessourceTest (QuarkusTest)

Java 17
Quarkus 3

You can reproduce it with a fresh Quarkus projets

@ricardozanini
Copy link
Member Author

@rmanibus mind taking a look?

@Postremus
Copy link
Contributor

@rmanibus facing the same issue.
The quarkus start appears to be blocked after the message WARN [io.qua.arc.pro.BeanArchives] (build-51) Failed to index io.quarkus.oidc.client.runtime.AbstractTokensProducer: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: TEST for AskRessourceTest (QuarkusTest)

The blocked start seems to be triggered by having quarkus-hibernate-validator as dependency in the project.

Reproducer:
sloww-openapi-gen-start.zip

unpack, and simply execute mvn quarkus:dev. Does not start.
Remove quarkus-hibernate-validator, mvn quarkus:dev, starts

@ricardozanini
Copy link
Member Author

@rmanibus, did you have the chance to take a look at it?

@Postremus I'm busy with #852. As soon as I fix it (it was more challenging than I first foresaw), I'll fix this one, too, if the original author of the feature cannot.

@rmanibus
Copy link
Contributor

I will have a look over the weekend, sorry I am pretty busy this week !

@ricardozanini ricardozanini reopened this Nov 25, 2024
@ricardozanini
Copy link
Member Author

Reopening this issue since we are still getting many complains from the community after this change. I'll work on it this week cc @gastaldi

@ricardozanini
Copy link
Member Author

Quarkus core issue: quarkusio/quarkus#44689

@ricardozanini
Copy link
Member Author

It seems that a few extensions are triggering this problem. The file io.quarkus.oidc.client.runtime.AbstractTokensProducer is being referenced only on a couple files in the runtime side. I'm doing a few tests here, should soon have a fix.

ricardozanini added a commit to ricardozanini/quarkus-openapi-generator that referenced this issue Nov 25, 2024
@ricardozanini
Copy link
Member Author

@oben01 @Postremus @vhuc @vkn can you please try this PR on your end? #872

@vkn
Copy link

vkn commented Nov 26, 2024

@ricardozanini works for me

@oben01
Copy link
Contributor

oben01 commented Nov 27, 2024

Works for me also thank u

ricardozanini added a commit that referenced this issue Nov 27, 2024
…ncies (#872)

* Fix #824 - Introduce a separated OIDC module to hold security dependencies

Signed-off-by: Ricardo Zanini <[email protected]>

* Fix  parent module

Signed-off-by: Ricardo Zanini <[email protected]>

---------

Signed-off-by: Ricardo Zanini <[email protected]>
github-actions bot pushed a commit that referenced this issue Nov 27, 2024
…ncies (#872)

* Fix #824 - Introduce a separated OIDC module to hold security dependencies

Signed-off-by: Ricardo Zanini <[email protected]>

* Fix  parent module

Signed-off-by: Ricardo Zanini <[email protected]>

---------

Signed-off-by: Ricardo Zanini <[email protected]>
ricardozanini added a commit that referenced this issue Dec 2, 2024
…ncies (#872) (#874)

* Fix #824 - Introduce a separated OIDC module to hold security dependencies



* Fix  parent module



---------

Signed-off-by: Ricardo Zanini <[email protected]>
Co-authored-by: Ricardo Zanini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:client This item is related to the client extension bug Something isn't working
Projects
None yet
6 participants