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

Native Image doesn't work on Windows 10 since graalvm-ce-java11-windows-amd64-20.3.1 #3140

Closed
kwang1 opened this issue Jan 21, 2021 · 8 comments · Fixed by Karm/mandrel-integration-tests#15
Assignees

Comments

@kwang1
Copy link

kwang1 commented Jan 21, 2021

Describe the issue

graalvm-ce-java11-windows-amd64-20.2.0 works fine on my Windows 10, but since graalvm-ce-java11-windows-amd64-20.3.1, I got following exception. I also tried graalvm-ce-java11-21.0.0, it has the same problem.

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. create a empty micronaut project with micronaut cli mn create-app com.example.app, micronaut version is 2.2.3.
  2. run gradlew assemble
  3. run native-image -jar "<full-path-to-jar>/app-0.1-all.jar

Describe GraalVM and your environment:

  • GraalVM version graalvm-ce-java11-windows-amd64-20.3.1
  • JDK major version: JDK 11
  • OS: Windows
  • Architecture: [AMD64]

More details

   G:\MyStuff\My Projects\trade-recorder>native-image -jar build/libs/trade-recorder-0.1-all.jar -H:+ReportExceptionStackTraces
[trade-recorder-0.1-all:10300]    classlist:   1,594.24 ms,  0.94 GB
[trade-recorder-0.1-all:10300]        setup:     288.41 ms,  0.94 GB
Error: Incompatible change of initialization policy for com.sun.jndi.dns.DnsClient: trying to change RUN_TIME from the command line to RERUN Contains Random references, therefore can't be included in the image heap.
com.oracle.svm.core.util.UserError$UserException: Incompatible change of initialization policy for com.sun.jndi.dns.DnsClient: trying to change RUN_TIME from the command line to RERUN Contains Random references, therefore can't be included in the image heap.
        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:99)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insert(ClassInitializationConfiguration.java:64)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.rerunInitialization(ConfigurableClassInitialization.java:253)
        at com.oracle.svm.hosted.jdk.JDKInitializationFeature.afterRegistration(JDKInitializationFeature.java:123)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$11(NativeImageGenerator.java:839)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:839)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:554)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:469)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1
@minhdtb
Copy link

minhdtb commented Jan 22, 2021

Same error today

@kkriske
Copy link
Contributor

kkriske commented Jan 22, 2021

Are you by any chance compiling a micronaut app? If so it should be fixed by using the upcomming 2.3.0 release that may come out any moment.
I had the same exact issue because com.sun.jndi.dns.DnsClient is marked for runtime initialization in a config file (in my case, provided by micronaut). Some config somewhere will probably have done the same for you.

Fix is to remove the config entry.

@munishchouhan munishchouhan self-assigned this Jan 25, 2021
@munishchouhan
Copy link
Contributor

@kwang1 Thanks for reporting the issue
please provide the reproducer

@krisfoster
Copy link
Member

I had the same issue. Seems to be resolved by updating micronaut and then updating the version of the micronaut libs in the gradle.properties & the build.gradle files. This has worked for me so far - though I am thinking I should double check this

@kwang1
Copy link
Author

kwang1 commented Feb 1, 2021

Are you by any chance compiling a micronaut app? If so it should be fixed by using the upcomming 2.3.0 release that may come out any moment.
I had the same exact issue because com.sun.jndi.dns.DnsClient is marked for runtime initialization in a config file (in my case, provided by micronaut). Some config somewhere will probably have done the same for you.

Fix is to remove the config entry.

Yes, @kkriske. I did run 'native-image' on the jar generated by micronaut. After I upgrade micronaut to 2.3.0, no exceptions at all.
Thanks a lot.

@kwang1
Copy link
Author

kwang1 commented Feb 1, 2021

@kwang1 Thanks for reporting the issue
please provide the reproducer

Hi @mcraj017 , do you mean how to test? I just added those steps.
Would this be an issue of Micronuat or Native image?

Thanks

@munishchouhan
Copy link
Contributor

@kwang1 Its a micronaut issue, if upgrading micronaut solves the issue
do you still need any help?

@munishchouhan
Copy link
Contributor

@kwang1 closing this issue as there is no response from user from last 1 month

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants