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

Error creating graal native image using Graal-rc8 #766

Closed
ilopmar opened this issue Oct 23, 2018 · 15 comments
Closed

Error creating graal native image using Graal-rc8 #766

ilopmar opened this issue Oct 23, 2018 · 15 comments
Labels
relates-to: graal status: awaiting third-party Awaiting changes to a third party library

Comments

@ilopmar
Copy link
Contributor

ilopmar commented Oct 23, 2018

Graal Class Loading Analysis Enabled.
Graal Class Loading Analysis Enabled.
Writing reflect.json file to destination: build/reflect.json
[complete:14079]    classlist:   3,926.91 ms
[complete:14079]        (cap):   1,058.73 ms
[complete:14079]        setup:   2,529.97 ms
Warning: class initialization of class io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator failed with exception java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider. This class will be initialized at runtime because option --report-unsupported-elements-at-runtime is used for image building. Use the option --delay-class-initialization-to-runtime=io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator to explicitly request delayed initialization of this class.
Warning: class initialization of class io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator failed with exception java.lang.ExceptionInInitializerError. This class will be initialized at runtime because option --report-unsupported-elements-at-runtime is used for image building. Use the option --delay-class-initialization-to-runtime=io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator to explicitly request delayed initialization of this class.
Warning: class initialization of class io.netty.handler.ssl.ReferenceCountedOpenSslEngine failed with exception java.lang.NoClassDefFoundError: io/netty/internal/tcnative/SSL. This class will be initialized at runtime because option --report-unsupported-elements-at-runtime is used for image building. Use the option --delay-class-initialization-to-runtime=io.netty.handler.ssl.ReferenceCountedOpenSslEngine to explicitly request delayed initialization of this class.
[complete:14079]     analysis:  46,243.23 ms
2 fatal errors detected:
fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at parsing io.micronaut.reactive.reactor.$ReactorInstrumentationDefinitionClass.getBeanType(Unknown Source)
	at org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2406)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:89)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3146)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2950)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:888)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:782)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:95)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:197)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:204)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:323)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
	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:186)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:347)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:389)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:508)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:174)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	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.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
	at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
	at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
	at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
	at java.lang.Class.createAnnotationData(Class.java:3521)
	at java.lang.Class.annotationData(Class.java:3510)
	at java.lang.Class.getAnnotation(Class.java:3415)
	at jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getAnnotation(HotSpotResolvedObjectTypeImpl.java:800)
	at com.oracle.svm.hosted.SVMHost.platformSupported(SVMHost.java:160)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:201)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:193)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:170)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:69)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupConstant(WrappedConstantPool.java:170)
	at org.graalvm.compiler.java.BytecodeParser.lookupConstant(BytecodeParser.java:3954)
	at org.graalvm.compiler.java.BytecodeParser.genLoadConstant(BytecodeParser.java:3665)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genLoadConstant(SharedGraphBuilderPhase.java:356)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4704)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3141)
	... 23 more
fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at parsing io.micronaut.reactive.reactor.$ReactorInstrumentationDefinitionClass.getBeanType(Unknown Source)
	at org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2406)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:89)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3146)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2950)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:888)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:782)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:95)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:197)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:204)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:323)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
	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:186)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:347)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:389)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:508)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:174)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	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.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
	at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
	at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
	at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
	at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
	at java.lang.Class.createAnnotationData(Class.java:3521)
	at java.lang.Class.annotationData(Class.java:3510)
	at java.lang.Class.getAnnotation(Class.java:3415)
	at jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getAnnotation(HotSpotResolvedObjectTypeImpl.java:800)
	at com.oracle.svm.hosted.SVMHost.platformSupported(SVMHost.java:160)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:201)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:193)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:170)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:69)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupConstant(WrappedConstantPool.java:170)
	at org.graalvm.compiler.java.BytecodeParser.lookupConstant(BytecodeParser.java:3954)
	at org.graalvm.compiler.java.BytecodeParser.genLoadConstant(BytecodeParser.java:3665)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genLoadConstant(SharedGraphBuilderPhase.java:356)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4704)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3141)
	... 23 more
Error: Image building with exit status 1
@graemerocher
Copy link
Contributor

This is probably because Graal now processes META-INF/services and oracle/graal#597 is unimplemented.

@youwi
Copy link

youwi commented Oct 24, 2018

yeah.
build.gradle:
{
compileOnly "com.oracle.substratevm:svm"-->get lasted
}
https://jcenter.bintray.com/com/oracle/substratevm/svm/1.0.0-rc7 not exist.
https://jcenter.bintray.com/com/oracle/substratevm/svm/1.0.0-rc8/ there.

@jagedn
Copy link
Contributor

jagedn commented Oct 28, 2018

you need to include also '-H:-UseServiceLoaderFeature' argument to native-image

@satb
Copy link

satb commented Nov 10, 2018

If I use the -UseServiceLoaderFeature as suggested by @jagedn , I get the below error

Warning: class initialization of class io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator failed with exception java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider. This class will be initialized at runtime because option --report-unsupported-elements-at-runtime is used for image building. Use the option --delay-class-initialization-to-runtime=io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator to explicitly request delayed initialization of this class.
Warning: class initialization of class io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator failed with exception java.lang.ExceptionInInitializerError. This class will be initialized at runtime because option --report-unsupported-elements-at-runtime is used for image building. Use the option --delay-class-initialization-to-runtime=io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator to explicitly request delayed initialization of this class.
Warning: class initialization of class io.netty.handler.ssl.ReferenceCountedOpenSslEngine failed with exception java.lang.NoClassDefFoundError: io/netty/internal/tcnative/SSL. This class will be initialized at runtime because option --report-unsupported-elements-at-runtime is used for image building. Use the option --delay-class-initialization-to-runtime=io.netty.handler.ssl.ReferenceCountedOpenSslEngine to explicitly request delayed initialization of this class.
[hello-world:11279]     analysis:  14,398.43 ms
fatal error: java.lang.NoClassDefFoundError: Lcom/jcraft/jzlib/Deflater;
       	at java.lang.Class.getDeclaredFields0(Native Method)
       	at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
       	at java.lang.Class.getDeclaredField(Class.java:2068)
       	at jdk.vm.ci.hotspot.HotSpotResolvedJavaFieldImpl.toJava(HotSpotResolvedJavaFieldImpl.java:191)

@ilopmar
Copy link
Contributor Author

ilopmar commented Nov 12, 2018

That works with RC8. They introduced a regression in RC9, so nothing we can do it until they release RC10.
See oracle/graal#494 and oracle/graal#760

@ilopmar ilopmar added the status: awaiting third-party Awaiting changes to a third party library label Nov 12, 2018
@graemerocher
Copy link
Contributor

@ilopmar you tried with the new --allow-incomplete-classpath flag

@ilopmar
Copy link
Contributor Author

ilopmar commented Nov 12, 2018

No, I haven't built Graal from master branch to try the new flag. I'll add it to my todo list.

@wwadge
Copy link

wwadge commented Nov 14, 2018

As a workaround you can add jzlib to your classpath: compile "com.jcraft:jzlib:1.1.3"

@ilopmar
Copy link
Contributor Author

ilopmar commented Nov 22, 2018

I've been building localy graal from master branch and with the new --allow-incomplete-classpath option everything works fine. Once Oracle publish RC10 I'll update the documentation, the profile and the guides with the new options.

@graemerocher
Copy link
Contributor

Interesting you have it working, for me it fails with the issues reported in oracle/graal#812

@ilopmar
Copy link
Contributor Author

ilopmar commented Nov 22, 2018

I'm able to build and run without exception the app you link in oracle/graal#812 with both graal-rc8 and master using the generated reflect.json. If I use the one you have in the repo the native image starts but it finishes with

14:10:42.651 [main] INFO  io.micronaut.runtime.Micronaut - No embedded container found. Running as CLI application

@graemerocher
Copy link
Contributor

Hmm I think then you aren’t really using master even though you think you are

@ilopmar
Copy link
Contributor Author

ilopmar commented Nov 22, 2018

I'm using master at least for building the native image because if I try with rc8 or rc9 I get this error:

Error: Unrecognized option: --allow-incomplete-classpath

What I'm doing with rc8 is generating *-all.jar and reflect.json files because I'm not sure how to use the compiled graal-vm from master branch outside their build directory.
I mean, I can do inside graal/substratevm directory:

$ mx java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12-jvmci-0.50, mixed mode)

$ mx native-image --version
GraalVM Version 1.0.0-rc10-SNAPSHOT

But outside that directory those commands don't work.

@ilopmar
Copy link
Contributor Author

ilopmar commented Jan 22, 2019

I've updated the guide to Micronaut 1.0.3 and Graal RC11: http://guides.micronaut.io/micronaut-creating-first-graal-app/guide/index.html
It works adding -H:-UseServiceLoaderFeature and --allow-incomplete-classpath

@ilopmar
Copy link
Contributor Author

ilopmar commented Feb 8, 2019

Starting with Graal RC12 Graal supports Service Loaders so the flag -H:-UseServiceLoaderFeature is not needed anymore. Please take a look at the updated guide.

@ilopmar ilopmar closed this as completed Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relates-to: graal status: awaiting third-party Awaiting changes to a third party library
Projects
None yet
Development

No branches or pull requests

6 participants