graalvm / graal-js-jdk11-maven-demo

An example project how to run Graal/JavaScript on JDK 11 with Graal as optimizing JIT compiler for best performance.
Universal Permissive License v1.0
177 stars 63 forks source link

Fails on graalvm-ce-java11-22.3.0 #42

Open zenbones opened 1 year ago

zenbones commented 1 year ago

Windows 11...

C:\Users\david\Documents\graal-js-jdk11-maven-demo>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany.app:my-app >----------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ my-app ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\david\Documents\graal-js-jdk11-maven-demo\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ my-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ my-app ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\david\Documents\graal-js-jdk11-maven-demo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ my-app ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-dependency-plugin:2.10:copy (copy) @ my-app ---
[INFO] Configured Artifact: org.graalvm.compiler:compiler:22.2.0:jar
[INFO] Configured Artifact: org.graalvm.compiler:compiler-management:22.2.0:jar
[INFO] Configured Artifact: org.graalvm.truffle:truffle-api:22.2.0:jar
[INFO] Configured Artifact: org.graalvm.sdk:graal-sdk:22.2.0:jar
[INFO] Copying compiler-22.2.0.jar to C:\Users\david\Documents\graal-js-jdk11-maven-demo\target\compiler\compiler.jar
[INFO] Copying compiler-management-22.2.0.jar to C:\Users\david\Documents\graal-js-jdk11-maven-demo\target\compiler\compiler-management.jar
[INFO] Copying truffle-api-22.2.0.jar to C:\Users\david\Documents\graal-js-jdk11-maven-demo\target\compiler\truffle-api.jar
[INFO] Copying graal-sdk-22.2.0.jar to C:\Users\david\Documents\graal-js-jdk11-maven-demo\target\compiler\graal-sdk.jar
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ my-app ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.mycompany.app.AppTest
=== Nashorn via javax.script.ScriptEngine ===
ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider com.oracle.truffle.js.scriptengine.GraalJSEngineFactory could not be instantiated
Warning: Nashorn engine is planned to be removed from a future JDK release
warming up ...
warmup finished, now measuring
iteration: 235
iteration: 204
iteration: 205
iteration: 192
iteration: 216
iteration: 219
iteration: 236
iteration: 219
iteration: 213
iteration: 200
=== Graal.js via org.graalvm.polyglot.Context ===
=== Graal.js via javax.script.ScriptEngine ===
ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider com.oracle.truffle.js.scriptengine.GraalJSEngineFactory could not be instantiated
*** Graal.js not found ***
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 8.979 s <<< FAILURE! - in com.mycompany.app.AppTest
[ERROR] testGraalPolyglotSpeed(com.mycompany.app.AppTest)  Time elapsed: 0.011 s  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.graalvm.polyglot.Engine$ImplHolder
        at com.mycompany.app.AppTest.testGraalPolyglotSpeed(AppTest.java:59)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   AppTest.testGraalPolyglotSpeed:59 » NoClassDefFound Could not initialize class...
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.912 s
[INFO] Finished at: 2022-11-30T19:23:32-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project my-app: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\david\Documents\graal-js-jdk11-maven-demo\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[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/MojoFailureException

C:\Users\david\Documents\graal-js-jdk11-maven-demo>
fniephaus commented 1 year ago

You seem to be using graal-sdk-22.2.0.jar et al. on 22.3.0. Can you try again with the packages for 22.3.0?

ee08b397 commented 8 months ago

@zenbones Can you run mvn -v to see which JDK you are running with?

GraalVM doesn't work with one of the unit tests and gives AppTest.testGraalPolyglotSpeed:59 » NoClassDefFound Could not initialize class.... Need to switch to the "stock JDK" as mentioned in the https://github.com/graalvm/graal-js-jdk11-maven-demo/blob/master/README.md#running-graaljs-on-stock-jdk11.

E.g., this won't work Java version: 11.0.18, vendor: GraalVM Community, runtime: /Library/Java/JavaVirtualMachines/graalvm-ce-java11-22.3.1/Contents/Home

This works Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home