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

quarkus-hibernate-orm extension is breaking native-image generation #2482

Closed
luisnuxx opened this issue May 17, 2019 · 24 comments · Fixed by #5343
Closed

quarkus-hibernate-orm extension is breaking native-image generation #2482

luisnuxx opened this issue May 17, 2019 · 24 comments · Fixed by #5343
Assignees
Labels
area/hibernate-orm Hibernate ORM kind/bug Something isn't working
Milestone

Comments

@luisnuxx
Copy link

Java version: OpenJDK GraalVM CE 1.0.0-rc16
OS: MacOS (but also breaks the docker image generation)
Quarkus Version : <quarkus.version>0.15.0</quarkus.version>

<dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-hibernate-orm</artifactId>
</dependency>

mvn package -Pnative

is throwing the following errors:

[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] Running Quarkus native-image plugin on OpenJDK GraalVM CE 1.0.0-rc16
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /Library/Java/JavaVirtualMachines/graalvm-ce-1.0.0-rc16/Contents/Home/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dvertx.disableDnsResolver=true -J-Dio.netty.noUnsafe=true -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar profiler-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:-SpawnIsolates -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[profiler-1.0-SNAPSHOT-runner:57017]    classlist:  10,221.40 ms
[profiler-1.0-SNAPSHOT-runner:57017]        (cap):   1,516.96 ms
[profiler-1.0-SNAPSHOT-runner:57017]        setup:   3,081.53 ms
08:37:15,654 INFO  [org.jbo.threads] JBoss Threads version 3.0.0.Beta3
08:37:15,944 INFO  [com.arj.ats.arjuna] ARJUNA012170: TransactionStatusManager started on port 52432 and host 127.0.0.1 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
08:37:16,044 INFO  [org.xnio] XNIO version 3.7.0.Final
08:37:16,098 INFO  [org.xni.nio] XNIO NIO Implementation Version 3.7.0.Final
08:37:39,287 INFO  [org.hib.Version] HHH000412: Hibernate Core {5.4.2.Final}
[profiler-1.0-SNAPSHOT-runner:57017]     analysis:  46,709.21 ms
Printing call tree to /Users/foo/Development/Java/application/target/reports/call_tree_profiler-1.0-SNAPSHOT-runner_2019 0517_083812.txt
Printing list of used classes to /Users/foo/Development/Java/application/target/reports/used_classes_profiler-1.0-SNAPSHOT-runner_20190517_083815.txt
Printing list of used packages to /Users/foo/Development/Java/application/target/reports/used_packages_profiler-1.0-SNAPSHOT-runner_20190517_083815.txt
Error: Unsupported features in 3 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() 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.
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:1227)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:1227)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:323)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getConstantPool(java.lang.Class):s
	java.lang.System$2.getConstantPool(java.lang.Class):s
	sun.misc.JavaLangAccess.getConstantPool(java.lang.Class):s
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036



Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) 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.
Trace: 
	at parsing java.lang.System$2.getRawExecutableTypeAnnotations(System.java:1245)
Call path from entry point to java.lang.System$2.getRawExecutableTypeAnnotations(Executable): 
	at java.lang.System$2.getRawExecutableTypeAnnotations(System.java:1245)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	java.lang.System$2.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	sun.misc.JavaLangAccess.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036



Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() 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.
Trace: 
	at parsing java.lang.System$2.getRawClassTypeAnnotations(System.java:1242)
Call path from entry point to java.lang.System$2.getRawClassTypeAnnotations(Class): 
	at java.lang.System$2.getRawClassTypeAnnotations(System.java:1242)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:315)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getRawClassTypeAnnotations(java.lang.Class):b
	java.lang.System$2.getRawClassTypeAnnotations(java.lang.Class):b
	sun.misc.JavaLangAccess.getRawClassTypeAnnotations(java.lang.Class):b
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036




com.oracle.svm.core.util.UserError$UserException: Unsupported features in 3 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() 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.
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:1227)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:1227)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:323)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getConstantPool(java.lang.Class):s
	java.lang.System$2.getConstantPool(java.lang.Class):s
	sun.misc.JavaLangAccess.getConstantPool(java.lang.Class):s
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036



Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) 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.
Trace: 
	at parsing java.lang.System$2.getRawExecutableTypeAnnotations(System.java:1245)
Call path from entry point to java.lang.System$2.getRawExecutableTypeAnnotations(Executable): 
	at java.lang.System$2.getRawExecutableTypeAnnotations(System.java:1245)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	java.lang.System$2.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	sun.misc.JavaLangAccess.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036



Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() 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.
Trace: 
	at parsing java.lang.System$2.getRawClassTypeAnnotations(System.java:1242)
Call path from entry point to java.lang.System$2.getRawClassTypeAnnotations(Class): 
	at java.lang.System$2.getRawClassTypeAnnotations(System.java:1242)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:315)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getRawClassTypeAnnotations(java.lang.Class):b
	java.lang.System$2.getRawClassTypeAnnotations(java.lang.Class):b
	sun.misc.JavaLangAccess.getRawClassTypeAnnotations(java.lang.Class):b
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036




	at com.oracle.svm.core.util.UserError.abort(UserError.java:75)
	at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:218)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:734)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:524)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:442)
	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)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 3 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() 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.
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:1227)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:1227)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:323)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getConstantPool(java.lang.Class):s
	java.lang.System$2.getConstantPool(java.lang.Class):s
	sun.misc.JavaLangAccess.getConstantPool(java.lang.Class):s
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036



Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) 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.
Trace: 
	at parsing java.lang.System$2.getRawExecutableTypeAnnotations(System.java:1245)
Call path from entry point to java.lang.System$2.getRawExecutableTypeAnnotations(Executable): 
	at java.lang.System$2.getRawExecutableTypeAnnotations(System.java:1245)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	java.lang.System$2.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	sun.misc.JavaLangAccess.getRawExecutableTypeAnnotations(java.lang.reflect.Executable):b
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036



Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() 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.
Trace: 
	at parsing java.lang.System$2.getRawClassTypeAnnotations(System.java:1242)
Call path from entry point to java.lang.System$2.getRawClassTypeAnnotations(Class): 
	at java.lang.System$2.getRawClassTypeAnnotations(System.java:1242)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:315)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:299)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:244)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:237)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:241)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_703.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.undertow.protocols.alpn.OpenSSLAlpnProvider.setProtocols(OpenSSLAlpnProvider.java:70)
	at io.undertow.server.protocol.http.AlpnOpenListener$1$1.run(AlpnOpenListener.java:296)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
	at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:145)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
--------------------------------------------------------------------------------------------
-- WARNING: The above stack trace is not a real stack trace, it is a theoretical call tree---
-- If an interface has multiple implementations SVM will just display one potential call  ---
-- path to the interface. This is often meaningless, and what you actually need to know is---
-- the path to the constructor of the object that implements this interface.              ---
-- Quarkus has attempted to generate a more meaningful call flow analysis below          ---
---------------------------------------------------------------------------------------------

Possible path to java.lang.System$2.getRawClassTypeAnnotations(java.lang.Class):b
	java.lang.System$2.getRawClassTypeAnnotations(java.lang.Class):b
	sun.misc.JavaLangAccess.getRawClassTypeAnnotations(java.lang.Class):b
	sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(java.lang.reflect.AnnotatedElement):s
	sun.reflect.annotation.TypeAnnotationParser.fetchBounds(java.lang.reflect.GenericDeclaration):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int, sun.reflect.annotation.TypeAnnotation$LocationInfo):j
	sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(java.lang.reflect.Type[], java.lang.reflect.GenericDeclaration, int):j
	sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds():j
	java.lang.reflect.TypeVariable.getAnnotatedBounds():j
	com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036.invoke(java.lang.Object, java.lang.Object[]):j
This is an implementation of sun.reflect.MethodAccessor printing path to constructors of com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036




	at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:133)
	at com.oracle.graal.pointsto.BigBang.finish(BigBang.java:564)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:685)
	... 7 more
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:28 min
[INFO] Finished at: 2019-05-17T08:38:20+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.15.0:native-image (default) on project profiler: Failed to generate a native image: Failed to build native image: Image generation failed -> [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

if I comment the dependency in pom.xml , everything starts working as expected

@gsmet
Copy link
Member

gsmet commented May 17, 2019

It's weird because AFAICS the error looks more related to Undertow than to Hibernate ORM.

Any chance you could share a minimal reproducer?

@luisnuxx
Copy link
Author

luisnuxx commented May 17, 2019

issue_2482.zip

Attached a basic hello world that reproduces the issue.

just run:
mvn package -Pnative

@Sanne
Copy link
Member

Sanne commented May 17, 2019

Thanks for the reproducer!

That kind of exception usually means we have a substitution for some component which is also being substituted by graalvm.

We'll need to debug the compiler to figure out the details, but I suspect it's not a specific issue of the quarkus-hibernate-orm extension, more likely a core issue.

@rsvoboda
Copy link
Member

rsvoboda commented Jun 3, 2019

I hit this issue when playing with https://github.com/AdamBien/quarkee

@emmanuelbernard
Copy link
Member

I did some tests as Iw as curious since it goes into my usual demo path.

If you add a @Entity and some database.* info in application.properties the error is gone.
If you create a default new project (no rest endpoint) and mvn quarkus:add-extensions -Dextensions=io.quarkus:quarkus-hibernate-orm it will fail with a similar stack trace as reported.

So I suppose there is a state here when Hibernate is not started that leads to a call path that is problematic. It is not necessary the blank ORM, it might be just agreal or just narayana but I could not reproduce with just narayana or agroal as direct dependency.

Actualy with just narayana as a dep it works, with agroal as a dependency I have a different GraalVM possible stack trace error.

@emmanuelbernard
Copy link
Member

CC @gsmet to pick your curiosity ;)

@gsmet
Copy link
Member

gsmet commented Jun 4, 2019

Yeah, my curiosity was picked a few weeks ago. I tried to get a viable error from GraalVM and had to tweak the code a bit to avoid some false positives.

In the end I ended up with a suspicion that maybe it could be related to Narayana. But it's really hard to say what's going on.

I was sidetracked (a lot) but this one is still on my list.

@gsmet gsmet self-assigned this Jun 4, 2019
@gsmet gsmet added this to the 0.17.0 milestone Jun 4, 2019
@emmanuelbernard
Copy link
Member

Blame @nmcl ! :)

@Sanne
Copy link
Member

Sanne commented Jun 4, 2019

I've been in touch with @mmusgrov , he's going to send some improvements to the Narayana extension.

In particular we should be able to get rid of the substitutions, maybe wait for that, it might be easier to figure out what's going on here?

@emmanuelbernard
Copy link
Member

What's your expected timeframe @mmusgrov ? 1d 1w 1m 6m 1y never?

@gsmet
Copy link
Member

gsmet commented Jun 19, 2019

FWIW It's still an issue with current master as of today.

@gsmet gsmet modified the milestones: 0.17.0, 0.18.0 Jun 19, 2019
@emmanuelbernard
Copy link
Member

Right. I don’t think we should wait for the transaction improvements before we investigation.

@gsmet gsmet modified the milestones: 0.18.0, 0.19.0 Jun 25, 2019
@gsmet gsmet modified the milestones: 0.19.0, 0.20.0 Jul 9, 2019
@gsmet gsmet modified the milestones: 0.20.0, 0.21.0 Jul 31, 2019
@rsvoboda
Copy link
Member

Any update / plan for this issue ?

@jaikiran
Copy link
Member

jaikiran commented Oct 8, 2019

So debugging this a bit, I have been able to narrow this down and solve one part of this issue. I can reproduce the issue consistently if I use a simple application with a dependency on the quarkus-hibernate-orm extension (and no other extension) and then run:

mvn clean verify -Pnative

(even against latest upstream master). With that command it throws a bunch of substrate exceptions which are hard to understand. So I introduced the

<additionalBuildArgs>--report-unsupported-elements-at-runtime</additionalBuildArgs>

in my pom.xml for the native image build and that showed up some interesting exceptions. For example of them is:

Fatal error: java.lang.NoClassDefFoundError
	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:461)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:310)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:448)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:113)
Caused by: java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.getDeclaredMethods(Class.java:1975)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleDeletedClass(AnnotationSubstitutionProcessor.java:437)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:270)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:230)
	at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:875)
	at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:824)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:524)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:444)
	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)
Caused by: java.lang.ClassNotFoundException: javax.security.jacc.PolicyContextException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 15 more

Debugging this showed that, this exception happens because the Hibernate ORM extension has this @Delete substitution:

@TargetClass(className = "org.hibernate.secure.internal.StandardJaccServiceImpl")
@Delete
public final class Delete_StandardJaccServiceImpl {
}

(I'm not an exepert, but) the way Substrate seems to deal with deletes is that it loads the target class (org.hibernate.secure.internal.StandardJaccServiceImpl) first and then does a getDeclaredMethods and getDeclaredFields on it, which obviously means that it needs the necessary dependency classes to be present (or else you will run into the exception above). StandardJaccServiceImpl has depedency on jacc classes. Looking at the quarkus-hiberate-orm extension it doesn't list the dependency on the artifact which brings in these javax.security.jacc.* classes. Looking at the upstream hibernate-orm project, that dependency is actually a provided scope dependency[1], so the inclusion of hibernate-core artifact doesn't bring this in. So I updated our quarkus-hibernate-orm extension to bring in that dependency explicitly (pull request at [2]) just to allow this substitution to work correctly and then rebuilt the quickstart project with this newer quarkus-hibernate-orm. This time there were no more errors with:

<additionalBuildArgs>--report-unsupported-elements-at-runtime</additionalBuildArgs>

But of course, that doesn't mean we won't run into exceptions at runtime on first access. So I decided to remove that param and rebuild and this time I see lesser number of errors - 3 of them to be precise. All of those 3 are:

Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class

So it appears that the java.lang.Class is actually substituted (right in the substrate VM here[3]) and that substituted version doesn't support these getExecutableTypeAnnotationBytes getRawTypeAnnotations and getConstantPool methods. But some piece of code within this quarkus application seems to be ending up calling it. I have the analysis tree generated out of this run but I'm yet to fully understand how to parse these substrate VM logs.

[1] https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/hibernate-core.gradle#L52
[2] #4440
[3] https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java#L97

@gsmet
Copy link
Member

gsmet commented Oct 8, 2019 via email

@jaikiran
Copy link
Member

jaikiran commented Oct 8, 2019

The big question is: why does it work when you really use Hibernate ORM :)

Good question - I was curious too :) But turns out it doesn't work even with that "use an @Entity workaround and thus really enable hibernate orm" workaround. Here's a project/application https://github.com/jaikiran/quarkus-2482 which fails against upstream master (without my patch) and it does have the @Entity in it.

@jaikiran
Copy link
Member

jaikiran commented Oct 8, 2019

(I'm not an exepert, but) the way Substrate seems to deal with deletes is that it loads the target class (org.hibernate.secure.internal.StandardJaccServiceImpl) first and then does a getDeclaredMethods and getDeclaredFields on it, which obviously means that it needs the necessary dependency classes to be present (or else you will run into the exception above).

I was thinking of asking about this at the graal project github repo, but it looks like @Sanne already ran into this previously and has reported it here oracle/graal#819

@gsmet
Copy link
Member

gsmet commented Oct 8, 2019

@Sanne says in the issue that he could get rid of the entire class to solve the issue for him so I'm not sure it applies to the case where we delete the entire class.

@gsmet
Copy link
Member

gsmet commented Oct 8, 2019

Good question - I was curious too :) But turns out it doesn't work even with that "use an @entity workaround and thus really enable hibernate orm" workaround. Here's a project/application https://github.com/jaikiran/quarkus-2482 which fails against upstream master (without my patch) and it does have the @entity in it.

OK but we have projects working? Typically, this very simple project work OK: https://github.com/gsmet/hibernate-search-demo .

So there's something that makes it work somehow.

@jaikiran
Copy link
Member

jaikiran commented Oct 8, 2019

OK but we have projects working? Typically, this very simple project work OK: https://github.com/gsmet/hibernate-search-demo .

So there's something that makes it work somehow.

Actually, even that project fails if I add the following in the pom.xml and run mvn clean verify -Pnative:

@@ -106,6 +106,8 @@
                 </goals>
                 <configuration>
                   <enableHttpUrlHandler>true</enableHttpUrlHandler>
+                  <additionalBuildArgs>--report-unsupported-elements-at-runtime</additionalBuildArgs>
+
                 </configuration>

It fails with:

[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] graalvm/graalvm-ce-19.2.0.1/Contents/Home/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dio.netty.allocator.maxOrder=1 -J-Dvertx.disableDnsResolver=true --report-unsupported-elements-at-runtime --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar hibernate-search-demo-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:Log=registerResource: -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[hibernate-search-demo-1.0-SNAPSHOT-runner:94789]    classlist:  10,352.37 ms
[hibernate-search-demo-1.0-SNAPSHOT-runner:94789]        setup:     400.41 ms
Fatal error: java.lang.NoClassDefFoundError
	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:461)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:310)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:448)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:113)
Caused by: java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.getDeclaredMethods(Class.java:1975)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleDeletedClass(AnnotationSubstitutionProcessor.java:437)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:270)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:230)
	at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:875)
	at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:824)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:524)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:444)
	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)
Caused by: java.lang.ClassNotFoundException: javax.security.jacc.PolicyContextException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 15 more

Quarkus version : latest upstream master
Graal VM version: 19.2.0.1

Removing that --report-unsupported-elements-at-runtime gets it to pass fine.

None of this looks right, so let me take a step back and see what part of this is Graal specific and what part is a genuine error that we need to sort out in Quarkus extension.

@gsmet gsmet removed this from the 0.24.0 milestone Oct 9, 2019
@Sanne
Copy link
Member

Sanne commented Oct 9, 2019 via email

@jaikiran
Copy link
Member

I've had numerous problems with "report-unsupported-elements-at-runtime";

Same here. It does look like a bug the way it's implemented. So I've raised it at graal oracle/graal#1725

@Sanne Sanne added area/hibernate-orm Hibernate ORM kind/bug Something isn't working labels Oct 30, 2019
@Sanne
Copy link
Member

Sanne commented Nov 8, 2019

I might have a solution soon for this, was working on #5262 and it turns out it might be a duplicate.

@Sanne
Copy link
Member

Sanne commented Nov 8, 2019

sent a PR :)

@Sanne Sanne assigned Sanne and unassigned gsmet Nov 11, 2019
@gsmet gsmet added this to the 1.0.0.Final milestone Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants