Skip to content

NullPointerException when running image-native application #6118

@brunotitata

Description

@brunotitata

Describe the bug
I created an application to test the behavior, and when I compile the project for image-native and run it, I get a NullPointerException, and when I compile in the JVM the application works normally ...

Command executed:

./mvnw clean package -Pnative

Build Info:

[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/brunocosta/Documents/Projetos/Estudos/code-with-quarkus 3/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /Users/brunocosta/Documents/Projetos/Estudos/code-with-quarkus 3/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.3.0 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /Users/brunocosta/.sdkman/candidates/java/19.3.0.r11-grl/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]    classlist:  14,735.26 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]        (cap):   4,469.44 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]        setup:   6,890.75 ms
13:58:00,454 INFO  [org.hib.Version] HHH000412: Hibernate Core {5.4.10.Final}
13:58:00,562 INFO  [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
13:58:00,846 INFO  [org.hib.dia.Dialect] HHH000400: Using dialect: io.quarkus.hibernate.orm.runtime.dialect.QuarkusH2Dialect
13:58:03,165 INFO  [org.jbo.threads] JBoss Threads version 3.0.0.Final
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]   (typeflow): 104,299.67 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]    (objects):  54,472.19 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]   (features):   2,960.19 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]     analysis: 171,523.06 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]     (clinit):   2,505.26 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]     universe:  11,713.79 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]      (parse):  13,925.11 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]     (inline):  31,072.47 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]    (compile):  81,021.54 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]      compile: 135,058.30 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]        image:  10,065.49 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]        write:   2,967.18 ms
[code-with-quarkus-1.0.0-SNAPSHOT-runner:13052]      [total]: 354,163.29 ms
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 360249ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:06 min
[INFO] Finished at: 2019-12-11T15:03:32-02:00
[INFO] ------------------------------------------------------------------------

After compilation, when will I run:

➜  code-with-quarkus 3 git:(master) target/./code-with-quarkus-1.0.0-SNAPSHOT-runner
Exception in thread "main" java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:304)
	at io.quarkus.runtime.Application.start(Application.java:87)
	at io.quarkus.runtime.Application.run(Application.java:210)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:41)
Caused by: java.lang.NullPointerException
	at jdk.internal.loader.BootLoader.hasClassPath(BootLoader.java:101)
	at java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1189)
	at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1220)
	at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
	at java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
	at java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
	at org.eclipse.microprofile.config.spi.ConfigProviderResolver.loadSpi(ConfigProviderResolver.java:151)
	at org.eclipse.microprofile.config.spi.ConfigProviderResolver.loadSpi(ConfigProviderResolver.java:146)
	at org.eclipse.microprofile.config.spi.ConfigProviderResolver.loadSpi(ConfigProviderResolver.java:146)
	at org.eclipse.microprofile.config.spi.ConfigProviderResolver.instance(ConfigProviderResolver.java:119)
	at io.quarkus.runtime.generated.Config.readConfig(Config.zig:6457)
	at io.quarkus.runtime.generated.Config.createRunTimeConfig(Config.zig:3986)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:138)
	... 3 more

Screenshots
Screenshot 1
Screenshot 2

Environment (please complete the following information):

  • Output of uname -a or ver:
    Darwin MacBook-Pro-de-Bruno.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

  • Output of java -version:

openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-20191009173705.graal.jdk8u-src-tar-gz-b07)
OpenJDK 64-Bit GraalVM CE 19.3.0 (build 25.232-b07-jvmci-19.3-b05, mixed mode)
  • GraalVM version (if different from Java):
19.3.0.r11-grl
  • Quarkus version or git rev:
Quarkus - 1.1.0.CR1

Additional context
Link project GitHub: https://github.com/brunotitata/quarkus-project

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't workingtriage/duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions