NPE in native-image when running quarkus-maven-plugin on CLI
See original GitHub issueI’d like to experiment with some options to GraalVM’s native-image
, so I naively looked at this output:
[INFO] --- shamrock-maven-plugin:0.1.0:native-image (default) @ shamrock-quickstart ---
[INFO] Running Shamrock native-image plugin on OpenJDK 64-Bit Server VM
[/home/vorburger/bin/graalvm-ce-1.0.0-rc10/bin/native-image, -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager, -J-Dcom.sun.xml.internal.bind.v2.bytecode.ClassTailor.noOptimize=true, -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime, -jar, shamrock-quickstart-1.0-SNAPSHOT-runner.jar, -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1, -H:+PrintAnalysisCallTree, -H:EnableURLProtocols=http, -H:-JNI, --no-server, -H:-UseServiceLoaderFeature, -H:+StackTrace]
and copy/paste that, ditching the commas, and adding target/
before the JAR to run from e.g.
protean-quickstarts/getting-started-native instead of inside target, like so:
$ /home/vorburger/bin/graalvm-ce-1.0.0-rc10/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.sun.xml.internal.bind.v2.bytecode.ClassTailor.noOptimize=true -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar target/shamrock-quickstart-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:+PrintAnalysisCallTree -H:EnableURLProtocols=http -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
but this just leads to this NPE in Graal VM, does anyone happen to know what I’m missing:
[shamrock-quickstart-1.0-SNAPSHOT-runner:27789] classlist: 3,389.04 ms
[shamrock-quickstart-1.0-SNAPSHOT-runner:27789] setup: 94.18 ms
fatal error: java.lang.NullPointerException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:418)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:278)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:375)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:104)
Caused by: java.lang.NullPointerException
at com.oracle.graal.pointsto.reports.CallTreePrinter.buildCallTree(CallTreePrinter.java:155)
at com.oracle.graal.pointsto.reports.CallTreePrinter.print(CallTreePrinter.java:61)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:764)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:401)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image building with exit status 1
Perhaps the shamrock-maven-plugin could be made to print out the exact command it runs?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
duh! Right. It’s probably my shell (zsh) that interpolated
$BySpaceAndTime
as an (empty) env var; sorry.Indeed, I got it working now.
I’m using RC10. In order to truly make the mojo provide a copiable-pasteable version, I guess in an ideal world, further to b952a5c, it should add
'
escapes to args (only if they contain$
?) but you would probably have to put it around every “pair” (second) of args to avoid this issue.The InitialCollectionPolicy sets the GC collector for substrateVM. The strange behaviour is being caused by the way the native image binary is parsing the command line args. It is trying to instantiate com.oracle.svm.core.genscavenge.CollectionPolicy, which is a abstract class, instead of com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime
If you use the argument, -H:InitialCollectionPolicy=‘com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime’ it builds without error.
This is something that has changed between RC9 and RC10 of graalVM