quarkus: ORM Panache with Postgres fails on native compilation

Describe the bug

ORM Panache with Postgres fails on native compilation

Expected behavior

Native executable

Actual behavior

Exception is thrown.

To Reproduce Steps to reproduce the behavior:

  1. git clone git@github.com:lordofthejars/quarkus-cockroachdb.git
  2. ./mvnw clean package -Pnative -DskipTests
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.redhat.developers:cockroach-db >-----------------
[INFO] Building cockroach-db 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ cockroach-db ---
[INFO] Deleting /Users/asotobu/tmp/cockroach/cockroach-db/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ cockroach-db ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ cockroach-db ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/asotobu/tmp/cockroach/cockroach-db/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ cockroach-db ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/asotobu/tmp/cockroach/cockroach-db/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ cockroach-db ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/asotobu/tmp/cockroach/cockroach-db/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ cockroach-db ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ cockroach-db ---
[INFO] Building jar: /Users/asotobu/tmp/cockroach/cockroach-db/target/cockroach-db-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:1.5.0.CR1:build (default) @ cockroach-db ---
[INFO] [org.jboss.threads] JBoss Threads version 3.1.1.Final
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.4.16.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/asotobu/tmp/cockroach/cockroach-db/target/cockroach-db-1.0-SNAPSHOT-native-image-source-jar/cockroach-db-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /Users/asotobu/tmp/cockroach/cockroach-db/target/cockroach-db-1.0-SNAPSHOT-native-image-source-jar/cockroach-db-1.0-SNAPSHOT-runner.jar
[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] /Users/asotobu/Applications/graalvm-ce-java11-19.3.1/Contents/Home/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -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 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar cockroach-db-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http,https --enable-all-security-services --no-server -H:-UseServiceLoaderFeature -H:+StackTrace cockroach-db-1.0-SNAPSHOT-runner
[cockroach-db-1.0-SNAPSHOT-runner:3138]    classlist:  11,452.61 ms
[cockroach-db-1.0-SNAPSHOT-runner:3138]        (cap):   3,006.49 ms
[cockroach-db-1.0-SNAPSHOT-runner:3138]        setup:   5,474.61 ms
08:50:00,322 INFO  [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.16.Final
08:50:00,334 INFO  [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
08:50:00,383 INFO  [org.hib.dia.Dialect] HHH000400: Using dialect: io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL10Dialect
08:50:18,734 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
[cockroach-db-1.0-SNAPSHOT-runner:3138]     analysis:  45,719.66 ms
Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.oracle.svm.reflect.Class_getNestHost_d0409f1154f6242e625526eadd05fbcd60e7d7e9.invoke(java.lang.Object, java.lang.Object[])
Parsing context:
 parsing java.lang.reflect.Method.invoke(Method.java:566)
 parsing javax.enterprise.util.AnnotationLiteral.invoke(AnnotationLiteral.java:288)
 parsing javax.enterprise.util.AnnotationLiteral.getMemberValue(AnnotationLiteral.java:276)
 parsing javax.enterprise.util.AnnotationLiteral.hashCode(AnnotationLiteral.java:246)
 parsing org.graalvm.collections.EconomicMapImpl.getHashIndex(EconomicMapImpl.java:414)
 parsing org.graalvm.collections.EconomicMapImpl.findHash(EconomicMapImpl.java:285)
 parsing org.graalvm.collections.EconomicMapImpl.find(EconomicMapImpl.java:254)
 parsing org.graalvm.collections.EconomicMapImpl.get(EconomicMapImpl.java:245)
 parsing com.oracle.svm.core.option.SubstrateOptionsParser.parseOption(SubstrateOptionsParser.java:201)
 parsing com.oracle.svm.core.option.RuntimeOptionParser.parseOptionAtRuntime(RuntimeOptionParser.java:186)
 parsing com.oracle.svm.core.option.RuntimeOptionParser.parse(RuntimeOptionParser.java:156)
 parsing com.oracle.svm.core.option.RuntimeOptionParser.parseAndConsumeAllOptions(RuntimeOptionParser.java:77)
 parsing com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:132)
 parsing com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
 parsing com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)


 at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
 at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:327)
 at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:300)
 at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
 at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:191)
 at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:343)
 at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:385)
 at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:511)
 at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:171)
 at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
 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:177)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getNestHost() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
 at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:183)
 at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
 at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
 at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:397)
 at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:377)
 at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:75)
 at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
 at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
 at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:39)
 at com.oracle.svm.reflect.hosted.ReflectionSubstitutionType$ReflectiveInvokeMethod.buildGraph(ReflectionSubstitutionType.java:511)
 at com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:319)
 at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:185)
 at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:340)
 at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
 ... 13 more
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:10 min
[INFO] Finished at: 2020-05-28T08:50:45+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.5.0.CR1:build (default) on project cockroach-db: Failed to build quarkus application: io.quarkus.builder.BuildException: 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:358)
[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:564)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:932)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:832)
[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.imageGenerationFailed(NativeImageBuildStep.java:374)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:344)
[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

Configuration

quarkus.http.port=8090
quarkus.swagger-ui.always-include=true

quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:26257/mydb
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=root
quarkus.datasource.password=roach1
quarkus.hibernate-orm.database.generation=update

Environment (please complete the following information):

Quarkus 1.5.0.CR1

Additional context

Also happens with ./mvnw clean package -Pnative -Dquarkus.native.container-build=true -DskipTests

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I switched to JDK 11 and it worked. So yes this was the problem.

Weird things happen when you use a different JDK to compile the classes vs the JDK that’s underneath the one that generates the native images, e.g. https://github.com/graalvm/mandrel/issues/12.