Description
Describe GraalVM and your environment :
- GraalVM polyglot 23.1.1
- JDK version: IBM Semeru 17.0.7 (OpenJ9)
- OS and OS Version: macOS
- Architecture: aarch64
- The output of
java -Xinternalversion
:
Eclipse OpenJ9 IBM Semeru Runtime Open Edition 64-bit Server VM (17.0.7+7) from macosx-aarch64 JRE with Extensions for OpenJDK for Eclipse OpenJ9 17.0.7.0, built on May 18 2023 19:12:36 by openj9 with Apple clang version 13.0.0 (clang-1300.0.29.3) Target: arm64-apple-darwin20.5.0 Thread model: posix InstalledDir: /Applications/Xcode-13.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Have you verified this issue still happens when using the latest snapshot?
N/A (using Maven dependencies)
Describe the issue
I'm using the following Maven dependencies in my library project to use GraalJS so I can execute some JavaScript code.
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>23.1.1</version>
</dependency>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js</artifactId>
<version>23.1.1</version>
<type>pom</type>
</dependency>
The code is supposed to be compatible with all Java VMs version 17 and above.
It all works fine on Hotspot-based VMs (depending on whether GraalVM is used or not, I may get a warning about interpreter-only execution, but it works). However, on OpenJ9-based VMs, such as IBM Semeru, I get an exception about the Java Flight recorder module (jdk.jfr
) missing. This means currently I cannot use GraalJs to build my library because my project would not run, even slowly, on OpenJ9-based JVMs.
Surprisingly enough, when I create and add a fake module named jdk.jfr
with no actual code in it to the module path, everything works as expected.
This indicates that jdk.jfr
is actually not required. It would be very helpful to detect this situation and allow execution of GraalJs on OpenJ9 based VMs.
Code snippet or code repository that reproduces the issue
org.graalvm.polyglot.Engine.newBuilder().build()
Steps to reproduce the issue
Please include both build steps as well as run steps
- Compile a class that executes the above code snippet.
- Run with GraalVM (succeeds)
- Run with OpenJDK 17 (succeeds)
- Run with IBM Semeru 17 (OpenJ9) (fails -- workaround is to add a dummy module named "jdk.jfr", i.e., create a project with a corresponding module-info.java and add to the module path)
Expected behavior
The code should execute in all three environments.
Additional context
Add any other context about the problem here. Specially important are stack traces or log output. Feel free to link to gists or to screenshots if necesary
Exception in thread "main" java.lang.InternalError: The polyglot class isolation failed to load and resolve the module layer. This is typically caused by invalid class-path-entries or duplicated packages on the class-path. Use -Dpolyglotimpl.TraceClassPathIsolation=true to print more details about class loading isolation. If the problem persists, it is recommended to use the module-path instead of the class-path to load polyglot.
at org.graalvm.polyglot.Engine$ClassPathIsolation.createIsolatedTruffleModule(Engine.java:1812)
at org.graalvm.polyglot.Engine$ClassPathIsolation.createIsolatedTruffle(Engine.java:1723)
at org.graalvm.polyglot.Engine$1.searchServiceLoader(Engine.java:1682)
at org.graalvm.polyglot.Engine$1.run(Engine.java:1668)
at org.graalvm.polyglot.Engine$1.run(Engine.java:1663)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:692)
at org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:1663)
at org.graalvm.polyglot.Engine$ImplHolder.<clinit>(Engine.java:186)
at org.graalvm.polyglot.Engine.getImpl(Engine.java:438)
at org.graalvm.polyglot.Engine$Builder.build(Engine.java:736)
at com.kohlschutter...
Caused by: java.lang.module.FindException: Module jdk.jfr not found, required by org.graalvm.polyglot
at java.base/java.lang.module.Resolver.findFail(Resolver.java:893)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:192)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:141)
at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:492)
at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:298)
at org.graalvm.polyglot.Engine$ClassPathIsolation.createIsolatedTruffleModule(Engine.java:1810)
... 12 more