I'm trying to build a native image from a Java 8 Jar file (I can provide this file) and have been using a slightly older version of GraalVM CE (version 19.2.1) because when I use the latest version (GraalVM Version CE 19.3.1) tp build the image I get an error like this [java.lang.NoClassDefFoundError: Lorg/codehaus/janino/ScriptEvaluator which I believe has already been reported via https://github.com/oracle/graal/issues/1943 hence I moved back to the version where this error does not occur.
Env: Linux/docker container
native-image version: GraalVM Version CE 19.2.1
Command:
native-image --no-fallback --no-fallback --report-unsupported-elements-at-runtime --allow-incomplete-classpath
-H:ReflectionConfigurationFiles=/home/app/META-INF/native-image/reflect-config.json
-H:DynamicProxyConfigurationFiles=/home/app/META-INF/native-image/proxy-config.json
-H:ResourceConfigurationFiles=/home/app/META-INF/native-image/resource-config.json
-H:JNIConfigurationFiles=/home/app/META-INF/native-image/jni-config.json
-H:+ReportExceptionStackTraces -jar path/to/jar/server-binary_deploy
Build on Server(pid: 1211, port: 34161)
[server-binary_deploy:1211] classlist: 183,467.42 ms
[server-binary_deploy:1211] (cap): 4,099.72 ms
[server-binary_deploy:1211] setup: 10,420.03 ms
[server-binary_deploy:1211] analysis: 200,589.41 ms
Error: Unsupported features in 6 methods
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call: java.lang.invoke.MethodHandle.bindTo(Object)
Trace:
at parsing java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandleImpl.java:221)
Call path from entry point to java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandle, MethodType, boolean, boolean):
at java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandleImpl.java:207)
at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:194)
at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:380)
at java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:776)
at java.lang.invoke.MethodHandle.asType(MethodHandle.java:761)
at java.lang.invoke.MethodHandleImpl.makeVarargsCollector(MethodHandleImpl.java:443)
at java.lang.invoke.MethodHandle.setVarargs(MethodHandle.java:1325)
at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:1670)
at java.lang.invoke.MethodHandles$Lookup.getDirectMethod(MethodHandles.java:1605)
at java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:781)
at java.lang.invoke.BoundMethodHandle$Factory.makeCbmhCtor(BoundMethodHandle.java:818)
at java.lang.invoke.BoundMethodHandle$Factory.makeCtors(BoundMethodHandle.java:763)
at java.lang.invoke.BoundMethodHandle$SpeciesData.<init>(BoundMethodHandle.java:349)
at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:389)
at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:383)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.SpinedBuffer.forEach(SpinedBuffer.java:246)
at java.util.stream.Nodes$SpinedNodeBuilder.forEach(Nodes.java:1262)
at java.util.stream.SpinedBuffer.toString(SpinedBuffer.java:269)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at com.oracle.svm.core.amd64.AMD64CPUFeatureAccess.verifyHostSupportsArchitecture(AMD64CPUFeatureAccess.java:179)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:129)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call: java.lang.invoke.MethodHandleImpl$BindCaller.prepareForInvoker(MethodHandle)
Trace:
at parsing java.lang.invoke.MethodHandleImpl$BindCaller.makeInjectedInvoker(MethodHandleImpl.java:1166)
Call path from entry point to java.lang.invoke.MethodHandleImpl$BindCaller.makeInjectedInvoker(Class):
at java.lang.invoke.MethodHandleImpl$BindCaller.makeInjectedInvoker(MethodHandleImpl.java:1141)
at java.lang.invoke.MethodHandleImpl$BindCaller.access$300(MethodHandleImpl.java:1122)
at java.lang.invoke.MethodHandleImpl$BindCaller$1.computeValue(MethodHandleImpl.java:1175)
at java.lang.invoke.MethodHandleImpl$BindCaller$1.computeValue(MethodHandleImpl.java:1173)
at com.oracle.svm.core.jdk.Target_java_lang_ClassValue.get(JavaLangSubstitutions.java:514)
at org.codehaus.groovy.reflection.ClassInfo.getClassInfo(ClassInfo.java:170)
at org.codehaus.groovy.runtime.MethodRankHelper.getMethodSuggestionString(MethodRankHelper.java:73)
at groovy.lang.MissingMethodException.getMessage(MissingMethodException.java:66)
at grakn.core.daemon.GraknDaemon.main(GraknDaemon.java:78)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
...
See rest of the exception message.
Looks like there are multiple errors reported. Stacktrace can be found here.
It's possible others have come across these and have some workaround or fix for it., would be nice to know, if any.
Hi @neomatrix369, it seems that you can work around java.lang.NoClassDefFoundError: Lorg/codehaus/janino/ScriptEvaluator using one of these:
Can you confirm that the issue still happens in GraalVM 20.0.0? If so, would you please share a reproducer?
@jramirez-isc thanks for that, I'll give it a whirl and report back, have not retried yet with the newest version of GraalVM
Hi @neomatrix369, did the new version fixes the issue? If that is not the case, can you please share the reproducer so we can provide better assistance?
Hi @neomatrix369, did the new version fixes the issue? If that is not the case, can you please share the reproducer so we can provide better assistance?
Thanks for proding, I didn't get a chance to try the new versions of GraalVM yet. Will feedback when I have got around it. Hoping the issue has faded away for good.
Hello @neomatrix369. Do you have any updates on this?
Hello @neomatrix369. Do you have any updates on this?
On my list to do next, I will get back to you with results
@fernando-valdez do you want me to check this in GraalVM 20.0.1 and/or GraalVM 20.1.0 (there is no GraalVM 20.0.0 from the releases page) I can try from both and give you a feedback but let me first try it with GraalVM 20.0.1
I'm currently checking this with GraalVM 20.1.0.
Hi @neomatrix369, it seems that you can work around
java.lang.NoClassDefFoundError: Lorg/codehaus/janino/ScriptEvaluatorusing one of these:Can you confirm that the issue still happens in
GraalVM 20.0.0? If so, would you please share a reproducer?
This does not happen anymore with GraalVM 20.1.0 on macOS (Sierra), I actually didn't need to any of the above sugestions (above quotes), so far it has built the native-image without any errors:
Build on Server(pid: 33638, port: 52326)*
[server-binary_deploy:33638] classlist: 156,776.93 ms, 4.10 GB
[server-binary_deploy:33638] (cap): 10,415.68 ms, 4.10 GB
[server-binary_deploy:33638] setup: 21,207.27 ms, 4.10 GB
[server-binary_deploy:33638] (clinit): 2,859.00 ms, 4.44 GB
[server-binary_deploy:33638] (typeflow): 282,450.30 ms, 4.44 GB
[server-binary_deploy:33638] (objects): 78,129.38 ms, 4.44 GB
[server-binary_deploy:33638] (features): 7,957.44 ms, 4.44 GB
[server-binary_deploy:33638] analysis: 376,378.57 ms, 4.44 GB
[server-binary_deploy:33638] universe: 9,685.20 ms, 3.97 GB
[server-binary_deploy:33638] (parse): 245,289.62 ms, 5.20 GB
[server-binary_deploy:33638] (inline): 31,929.05 ms, 5.23 GB
[server-binary_deploy:33638] (compile): 276,764.14 ms, 5.38 GB
[server-binary_deploy:33638] compile: 568,735.13 ms, 5.39 GB
[server-binary_deploy:33638] image: 33,810.13 ms, 5.39 GB
[server-binary_deploy:33638] write: 14,360.81 ms, 5.39 GB
[server-binary_deploy:33638] [total]: 1,183,478.69 ms, 5.39 GB
I do have issues when running it but that could be because I must have missed out something either during build-time or some other config when running it. I will look into this further as a separate task.
Let's keep this issue open for a few days and I'll let you know how it goes.
/cc @fernando-valdez
@neomatrix369, I am glad that the issue with java.lang.NoClassDefFoundError: Lorg/codehaus/janino/ScriptEvaluator is not longer present.
We will keep the bug open, please keep us posted for any new information you find.
@neomatrix369, I am glad that the issue with
java.lang.NoClassDefFoundError: Lorg/codehaus/janino/ScriptEvaluatoris not longer present.
We will keep the bug open, please keep us posted for any new information you find.
In addition, there has been no regression of this issue https://github.com/oracle/graal/issues/1533, which is also good news. Because the jar I raised the issue also had this issue many months ago - now fixed!