-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Upgrade to Micronaut 3.1.1 breaks cli application native-image binary #6406
Comments
From the error it looks like you either have duplicate JARs on your classpath or duplicate native image config where types are being registered twice. The linked project seems to be a custom native image build so it is hard to tell. |
Got same issue. @graemerocher i think that if we have a duplicate jar, or duplicate image config, we would get this error using micronaut 2.x too. I'm using maven, and OC is using gradle so that's not a build tool fault. Cheers. Edit: This happens only in tests, application can run correctly with mn:run Edit: this solved my issue. |
Thanks for the reply @graemerocher. I've tried to followup on this but without much success. Since the class that is being loaded multiple times ( |
@miguelaferreira do you have an example somewhere? |
oh hold on attached to the original issue |
I guess my question is why you need native image config at all in this app? |
Because without it the native binary wouldn't work. It would compile but then at runtime complain about missing classes. I've setup system tests that execute the standalone jar (instrumented with the native image agent), while calling all the application commands. That generates multiple sets of native image configurations, so I've built native image from source to create the native-image-configure tool that is able to merge the configuration in a single set, that I can then use to build a working native binary. I can try removing all that and just build the native binary with the default configuration generated by micronaut. I'll let you know the result of that. |
@miguelaferreira please try that and let us know what is wrong with the defaults |
@graemerocher I've removed the custom native image config (from Then I built the native image with GraalVM 21.3.0.r17-grl. sdk use java 21.3.0.r17-grl
~/.sdkman/candidates/java/current/bin/gu install native-image
./gradlew clean build nativeImage -x test The result is that the native binary does not execute correctly anymore. In the examples bellow I'm comparing the execution of the native binary with the execution of the jar with all dependencies. I would be happy to troubleshoot this, please let me know if there's anything I can do. Example: print the tool versionNative binary:
Jar:
Example: clone a gitlab organisation using SSH protocolNative binary:
Jar:
Example: clone a gitlab organisation using HTTPS protocolNative binary
Jar:
|
@miguelaferreira will take a look |
with PR miguelaferreira/devex-cli#18 Running:
|
Thank for the help @graemerocher! I ran the other tests and the tools are working well. I'm going to merge your PR. |
Expected Behavior
After following the Micronaut upgrade guide instructions I expected the compiled native binary to execute as before.
Actual Behaviour
When I execute the native binary I get the following error.
Steps To Reproduce
Step 6 will generate the error, while what should happen is that the GitLab group
gitlab-clone-example
should be cloned in the local directorytmp-clone-directory
.Environment Information
Example Application
miguelaferreira/devex-cli#10
Version
3.1.1
The text was updated successfully, but these errors were encountered: