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

Failed to augment application classes when using -H:ReflectionConfigurationFiles= #6598

Closed
phact opened this issue Jan 17, 2020 · 20 comments · Fixed by #6614
Closed

Failed to augment application classes when using -H:ReflectionConfigurationFiles= #6598

phact opened this issue Jan 17, 2020 · 20 comments · Fixed by #6614
Labels
kind/bug Something isn't working
Milestone

Comments

@phact
Copy link
Contributor

phact commented Jan 17, 2020

Describe the bug

NativeImageBuildStep fails when using -H:ReflectionConfigurationFiles=

Expected behavior

But if I copy and paste the native-image command and run it manually, it succeeds:

/target/project-1.0.0-SNAPSHOT-native-image-source-jar$ /opt/graalvm-ce-java11-19.3.1/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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 -H:ResourceConfigurationFiles=resources-config.json -H:Log=registerResource [[[-H:ReflectionConfigurationFiles=/reflection-config/reflect-config.json]]] --initialize-at-build-time= -H:InitialCollectionPolicy='com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime' -jar project-1.0.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace project-1.0.0-SNAPSHOT-runner
[project-1.0.0-SNAPSHOT-runner:21513]    classlist:   9,678.64 ms
[project-1.0.0-SNAPSHOT-runner:21513]        (cap):     735.07 ms
WARNING: Could not resolve jnr.ffi.provider.jffi.NativeClosureProxy$$impl$$0 for reflection configuration.
WARNING: Could not resolve jnr.posix.Crypt$jnr$ffi$2 for reflection configuration.
WARNING: Could not resolve jnr.posix.LinuxLibC$VariableAccessor$$0 for reflection configuration.
WARNING: Could not resolve jnr.posix.LinuxLibC$jnr$ffi$1 for reflection configuration.
[project-1.0.0-SNAPSHOT-runner:21513]        setup:   2,243.00 ms
01:25:55,279 INFO  [org.jbo.threads] JBoss Threads version 3.0.0.Final
01:26:01,317 INFO  [com.dat.oss.dri.int.cor.DefaultMavenCoordinates] DataStax Java driver for Apache Cassandra(R) (com.datastax.oss:java-driver-core) version 4.4.0
01:26:13,446 INFO  [com.dat.oss.dri.api.cor.uui.Uuids] PID obtained through native call to getpid(): 21513
Warning: RecomputeFieldValue.ArrayIndexScale automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.arrayIndexScale(Class) was detected in the static initializer of com.datastax.oss.driver.shaded.guava.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.arrayIndexScale(Class) for the array index scale computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store. 
[Use -Dgraal.LogFile=<path> to redirect Graal log output to a file.]
[thread:22] scope: ForkJoinPool-4-worker-3
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: reference.conf
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: application.conf
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: missions.json
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: resources-config.json
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: META-INF/native-image/io.netty/transport/reflection-config.json
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: missions.json
  [thread:22] scope: ForkJoinPool-4-worker-3.registerResource
  ResourcesFeature: registerResource: resources-config.json
[project-1.0.0-SNAPSHOT-runner:21513]   (typeflow):  23,642.53 ms
[project-1.0.0-SNAPSHOT-runner:21513]    (objects):  42,765.40 ms
[project-1.0.0-SNAPSHOT-runner:21513]   (features):   1,146.33 ms
[project-1.0.0-SNAPSHOT-runner:21513]     analysis:  69,512.81 ms
[project-1.0.0-SNAPSHOT-runner:21513]     (clinit):     813.65 ms
[project-1.0.0-SNAPSHOT-runner:21513]     universe:   2,697.51 ms
[project-1.0.0-SNAPSHOT-runner:21513]      (parse):   4,355.46 ms
[project-1.0.0-SNAPSHOT-runner:21513]     (inline):   8,367.99 ms
[project-1.0.0-SNAPSHOT-runner:21513]    (compile):  37,828.50 ms
[project-1.0.0-SNAPSHOT-runner:21513]      compile:  53,365.95 ms
[project-1.0.0-SNAPSHOT-runner:21513]        image:   4,717.68 ms
[lproject-1.0.0-SNAPSHOT-runner:21513]        write:   1,001.35 ms
[project-1.0.0-SNAPSHOT-runner:21513]      [total]: 143,565.69 ms

Actual behavior

./mvnw clean package -Pnative throws the following error:

INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /opt/graalvm-ce-java11-19.3.1/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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 -H:ResourceConfigurationFiles=resources-config.json -H:Log=registerResource  [[[-H:ReflectionConfigurationFiles=/reflection-config/reflect-config.json]]] --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar project-1.0.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace project-1.0.0-SNAPSHOT-runner
Error: Unknown argument: project-1.0.0-SNAPSHOT-runner
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.644 s
[INFO] Finished at: 2020-01-17T01:33:16-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.0.CR1:build (default) on project project: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:322)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:915)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] 	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] 	at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:311)
[ERROR] 	... 12 more
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.0.CR1:build (default) on project project: Failed to build a runnable JAR
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to build a runnable JAR
    at io.quarkus.maven.BuildMojo.execute (BuildMojo.java:194)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: io.quarkus.creator.AppCreatorException: Failed to augment application classes
    at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:188)
    at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:53)
    at io.quarkus.creator.CuratedApplicationCreator.runTask (CuratedApplicationCreator.java:139)
    at io.quarkus.maven.BuildMojo.execute (BuildMojo.java:178)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:322)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:915)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:311)
	... 12 more

    at io.quarkus.builder.Execution.run (Execution.java:108)
    at io.quarkus.builder.BuildExecutionBuilder.execute (BuildExecutionBuilder.java:121)
    at io.quarkus.deployment.QuarkusAugmentor.run (QuarkusAugmentor.java:128)
    at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:179)
    at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:53)
    at io.quarkus.creator.CuratedApplicationCreator.runTask (CuratedApplicationCreator.java:139)
    at io.quarkus.maven.BuildMojo.execute (BuildMojo.java:178)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
Caused by: java.lang.RuntimeException: Failed to build native image
    at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build (NativeImageBuildStep.java:322)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute (ExtensionLoader.java:915)
    at io.quarkus.builder.BuildContext.run (BuildContext.java:415)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run (ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun (EnhancedQueueExecutor.java:2011)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask (EnhancedQueueExecutor.java:1535)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1426)
    at java.lang.Thread.run (Thread.java:834)
    at org.jboss.threads.JBossThread.run (JBossThread.java:479)
Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
    at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build (NativeImageBuildStep.java:311)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at io.quarkus.deployment.ExtensionLoader$2.execute (ExtensionLoader.java:915)
    at io.quarkus.builder.BuildContext.run (BuildContext.java:415)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run (ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun (EnhancedQueueExecutor.java:2011)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask (EnhancedQueueExecutor.java:1535)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1426)
    at java.lang.Thread.run (Thread.java:834)
    at org.jboss.threads.JBossThread.run (JBossThread.java:479)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Configuration

quarkus.native.additional-build-args =\
  -H:ResourceConfigurationFiles=resources-config.json,\
  -H:Log=registerResource, \
  -H:ReflectionConfigurationFiles=./reflection-config/reflect-config.json
Args =\
   --allow-incomplete-classpath \
  --initialize-at-run-time=\
  io.netty.buffer.PooledByteBufAllocator,\
  io.netty.buffer.ByteBufAllocator,\
  io.netty.buffer.ByteBufUtil,\
  io.netty.buffer.AbstractReferenceCountedByteBuf,\
  com.jcraft.jsch.PortWatcher,\
  com.datastax.oss.driver.internal.core.metadata.MetadataManager \

Environment (please complete the following information):

  • Output of uname -a or ver:

    Linux wezn 5.3.0-26-generic Merge our two divergent heads #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Output of java -version:

    openjdk version "11.0.6" 2020-01-14
    OpenJDK Runtime Environment GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07)
    OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing)

  • Quarkus version or git rev:
    <quarkus.platform.version>1.1.0.CR1</quarkus.platform.version>

I don't understand how this would be since what gets printed out in the info log is exactly what gets run by the process builder.
https://github.com/quarkusio/quarkus/blob/1.1.0.CR1/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java#L298-L301

@phact phact added the kind/bug Something isn't working label Jan 17, 2020
@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

Noticed this line further up in the BuildStep

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.3.1 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /opt/graalvm-ce-java11-19.3.1/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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 -H:ResourceConfigurationFiles=resources-config.json -H:Log=registerResource  -H:ReflectionConfigurationFiles=./reflection-config/reflect-config.json --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar project-1.0.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace project-1.0.0-SNAPSHOT-runner
Error: Unknown argument: project-1.0.0-SNAPSHOT-runner

It does seem like the command is somehow malformed...

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

Just so we don't try and something that might already be solved, did you try 1.1.1.Final and/or Quarkus from master?

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

I was under the impression that 1.1.0.CR1 is the most modern release to support java 11. Is that no longer the case?

I am trying to stick to java 11 and GraalVM 19.3 if at all possible.

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

Java 11 support was indeed removed from Quarkus 1.1.0.Final indeed, but it should be back in 1.2.
However I would really like to know if you see the problem with 1.1.1.Final and with a java 8 if possible

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

okay I worked around my java11 usage, bumped up the quarkus version:

cat pom.xml | grep Final
    <quarkus-plugin.version>1.1.1.Final</quarkus-plugin.version>
    <quarkus.platform.version>1.1.1.Final</quarkus.platform.version>

and downgraded my graalvm version and I still get the error:

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.2.1 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /opt/graalvm-ce-19.2.1/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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 -H:ResourceConfigurationFiles=resources-config.json -H:Log=registerResource  -H:JNIConfigurationFiles=./reflection-config/jni-config.json  -H:ReflectionConfigurationFiles=./reflection-config/reflect-config.json   --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar project-1.0.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace project-1.0.0-SNAPSHOT-runner
Error: Unknown arguments:  -H:ReflectionConfigurationFiles=./reflection-config/reflect-config.json,  , project-1.0.0-SNAPSHOT-runner
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.391 s
[INFO] Finished at: 2020-01-17T11:26:27-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.1.Final:build (default) on project project: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:325)
[ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:915)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] 	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] 	at java.lang.Thread.run(Thread.java:748)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:314)
[ERROR] 	... 12 more
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

OK thank you for checking

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

Just to make sure we're executing the same thing, do you mind uploading a small reproducer containing the files and a README with the exact command you use to launch?

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

Here you go: https://github.com/phact/cassandra-quarkus-starter

I just run ./mvnw package -Pnative

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

Great, thanks a lot! I'll take a look over the weekend hopefully

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

That would be great. After I run package -Pnative goal and it fails, it creates the target/project-1.0.0-SNAPSHOT-native-image-source-jar.

If I cd in there and run the native-image command that gets logged to stdout by package -Pnative it works.

The exact native-image command I'm running is in the readme.

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

By the way (and maybe this should be a different issue) once I get the native-image to build as described above, it blows up at runtime with:

./project-1.0.0-SNAPSHOT-runner 
Exception in thread "main" java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:194)
	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.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.Converter: Provider io.quarkus.runtime.configuration.InetSocketAddressConverter not found
	at java.util.ServiceLoader.fail(ServiceLoader.java:588)
	at java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1211)
	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 java.lang.Iterable.forEach(Iterable.java:74)
	at io.smallrye.config.SmallRyeConfigBuilder.discoverConverters(SmallRyeConfigBuilder.java:86)
	at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:178)
	at io.quarkus.runtime.generated.Config.readConfig(Config.zig:4438)
	at io.quarkus.runtime.generated.Config.createRunTimeConfig(Config.zig:2777)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:52)
	... 3 more

@christianThor
Copy link

I also have encountered similar behavior with malformed command when I have TWO "additional build args" as shown in the application.properties. The docker command succeeds with only ONE build argument (either one works from the two I have put in application.properties). I hope this can help out.

Environment

  • graalvm 19.2.1
  • maven 3.5.4
  • quarkus 1.1.1.Final

Build Command
mvn clean install -Dnative -Dquarkus.native.container-build=true

application.properties with TWO additional-build-args

quarkus.lambda.handler=test
quarkus.ssl.native=true
quarkus.native.additional-build-args=-H:ReflectionConfigurationFiles=reflection-config.json, \
  --initialize-at-run-time=org.apache.avro.specific.SpecificDatumReader

Actual Behavior

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.2.1 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /Users/christian.thorenfeld/lsma/target/lsma-1.0-SNAPSHOT-native-image-source-jar:/project:z --rm quay.io/quarkus/ubi-quarkus-native-image:19.2.1 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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 -H:ReflectionConfigurationFiles=reflection-config.json  --initialize-at-run-time=org.apache.avro.specific.SpecificDatumReader --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar lsma-1.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 lsma-1.0-SNAPSHOT-runner
Error: Unknown argument: lsma-1.0-SNAPSHOT-runner
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.563 s
[INFO] Finished at: 2020-01-17T11:31:21-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.1.Final:build (default) on project lsma: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] 	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:325)
[ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:915)
[ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] 	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] 	at java.lang.Thread.run(Thread.java:748)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:314)
[ERROR] 	... 12 more
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

😮 looks like it works if I put the additional-build-args in a single line in the config rather than multi-line

quarkus.native.additional-build-args = -H:ResourceConfigurationFiles=resources-config.json,-H:Log=registerResource,-H:JNIConfigurationFiles=../../reflection-config/jni-config.json,-H:ReflectionConfigurationFiles=../../reflection-config/reflect-config.json

vs

quarkus.native.additional-build-args =\
  -H:ResourceConfigurationFiles=resources-config.json,\
  -H:Log=registerResource, \
  -H:JNIConfigurationFiles=./reflection-config/jni-config.json, \
  -H:ReflectionConfigurationFiles=./reflection-config/reflect-config.json

@christianThor
Copy link

I can confirm @phact's suggestion worked for me too! Thank you!

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

Let me give it a quick try and see what this is all about

geoand added a commit to geoand/quarkus that referenced this issue Jan 17, 2020
@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

So the problem turned out to be that in your multi-line string you had trailing whitespaces - if you remove them the multi-line string config works as well.

I nonetheless opened #6614 to make things easier for users

@phact
Copy link
Contributor Author

phact commented Jan 17, 2020

Thank you for the responsiveness and the level of attention to UX. Makes a huge difference to have this support.

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

Thank you for the excellent error reporting and help :)

@christianThor
Copy link

Also, I think there is a limitation with arguments with respect to comma separated lists. For example, this option accepts a comma separated list of classes as per here:

--initialize-at-run-time=<comma separated list of class/package names> initializes classes and implicitly all of their superclasses at run time and not during image building

@geoand
Copy link
Contributor

geoand commented Jan 17, 2020

@christianThor if you run into a specific problem with it, please open a new issue.

It could very well be the case (although I haven't seen anyone report it) and if it is having a detailed issue would be nice.

Thanks

@gsmet gsmet added this to the 1.2.0 milestone Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants