-
Notifications
You must be signed in to change notification settings - Fork 103
Invocation Target Exception during code generation #1086
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
Comments
OpenAPI 2.9.0 should be used with Quarkus 3.21. Can you try the |
I'm seeing the same error with 2.9.0+3.21 and 2.9.1-tls with 3.20. I wonder if there may be interfering dependencies. I searched for swagger in the dependency tree of the project and this is the only instance I found. Does smallrye-openapi interfere with the openapi generator?
|
@dcheng1248, it does! The Can you investigate if this library appears in different versions in your classpath? I think we will have to include it in the exclusions section and inherit from Quarkus BOM, as you did in your workaround. |
Sorry, would you be able to elaborate on this? I'm a bit confused about the explanation and how to look for the information asked. I only see the smallrye-open-api-core under smallrye-openapi in the tree, it seems. |
hmm I took a second look and we have:
Based on (client/deployment/pom.xml): <!-- Forces swagger-parser version to avoid conflict with Quarkus.
This is needed while org.openapitools:openapi-generator doesn't use swagger-parser 2.1.13 or greater -->
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>${version.io.swagger.parser}</version>
</dependency>
....
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator</artifactId>
<version>${version.org.openapitools}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</exclusion>
<exclusion>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
</exclusion>
<!-- Forces swagger-parser version to avoid conflict with Quarkus.
This is needed while org.openapitools:openapi-generator doesn't use swagger-parser 2.1.13 or greater -->
<exclusion>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
</exclusion>
</exclusions>
</dependency> We are removing But I think this version is outdated, and we might have to upgrade it to align with |
I did mvn dependency-tree and mvn quarkus:dependency-tree and found swagger core in neither (that is, after I commented out the swagger dependency). I did find swagger-parser 2.1.25 in the latter. On that note, I also ran into another dependency issue. Reported to quarkus at first but it seems the missing dependency also originates from openapi-generator: quarkusio/quarkus#47147. I'm not sure if they are related and if there are just some strange dependency clashes somewhere. Please let me know if I can do anything to provide more information. I should be able to respond over this weekend, but won't be available until the next weekend after that. |
@dcheng1248, what is the value for the version in this workaround? <dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core-jakarta</artifactId>
<version>${swagger.core.version}</version>
</dependency> |
@dcheng1248 can you provide your project as a simpler reproducer? |
It's 2.2.28. I'll try to see if I can get a reproducer in this weekend, if not next weekend. Thanks for looking into this. |
Here it is: https://github.com/dcheng1248/openapi-generator-1086-reproducer It seems to be a dependency clash within the quarkus-camel-bom. It was fine (also with smallrye-openapi) without this bom, but once I added it the error appeared. I tried quickly looking into the bom source but could not easily locate the swagger core version they are using. Since it is not actually clashing with quarkus core it probably isn't exactly a bug, although anything that could enhance developer experience (a note in documentation about the clash?) could be helpful. I will leave this issue open for your judgement. Thanks for the help again! |
Thanks for your help, @dcheng1248. I'll try to figure out something about it - maybe a doc like you mentioned or an actual fix. We can leave it open so others can find it in search. |
Tell us the extension you're using
Client
I tried this:
I'm not sure if this is really a bug or if I'm doing something wrong. I was using Quarkus v 3.19.4 or later and Quarkus OpenApi Generator v 2.9.0 (I am not sure at which exact versions did the error appear).
This happened:
I got this error during the maven code generation phase:
I expected this:
No response
Is there a workaround?
I had to add the following dependency to get the code generation to work:
How can we try to reproduce the issue?
No response
Anything else?
No response
Output of
uname -a
orver
Darwin Kernel Version 23.5.0
Output of
java -version
openjdk version "21.0.2" 2024-01-16
Quarkus OpenApi version or git rev
2.9.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.9
Additional information
No response
Community Notes
The text was updated successfully, but these errors were encountered: