oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.21k stars 1.62k forks source link

[GR-57724] Using GraalVM with JBOSS/Wildfly throws warning: does not support runtime compilation #9483

Open G33RY opened 1 month ago

G33RY commented 1 month ago

Describe GraalVM and your environment :

Describe the issue I want to run javascript code in my java web application that runs on Widfly 26. I get this warning every time:

10:41:32,229 ERROR [stderr] (default task-1) [To redirect Truffle log output to a file use one of the following options:
10:41:32,229 ERROR [stderr] (default task-1) * '--log.file=<path>' if the option is passed using a guest language launcher.
10:41:32,229 ERROR [stderr] (default task-1) * '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
10:41:32,229 ERROR [stderr] (default task-1) * Configure logging using the polyglot embedding API.]
10:41:32,229 ERROR [stderr] (default task-1) [engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation.
10:41:32,229 ERROR [stderr] (default task-1) The guest application code will therefore be executed in interpreted mode only.
10:41:32,229 ERROR [stderr] (default task-1) Execution only in interpreted mode will strongly impact the guest application performance.
10:41:32,229 ERROR [stderr] (default task-1) For more information on using GraalVM see https://www.graalvm.org/java/quickstart/.
10:41:32,229 ERROR [stderr] (default task-1) To disable this warning the '--engine.WarnInterpreterOnly=false' option or use the '-Dpolyglot.engine.WarnInterpreterOnly=false' system property.

I am running wildfly on GraalVM so I dont know what would be the solution here. I dont want to supress the warning because I need the better performance of the normal mode.

I have imported these dependecies:

<dependency>
  <groupId>org.graalvm.sdk</groupId>
  <artifactId>graal-sdk</artifactId>
  <version>23.0.5</version>
</dependency>
<dependency>
  <groupId>org.graalvm.js</groupId>
  <artifactId>js</artifactId>
  <version>23.0.5</version>
  <scope>runtime</scope>
</dependency>

Code snippet or code repository that reproduces the issue testgraalvm.zip

selhagani commented 1 month ago

Hi @G33RY,

Thank you for reaching out to us! Did you try testing with out latest version of GraalVM? You can find it here https://www.oracle.com/java/technologies/downloads/#graalvmjava17

G33RY commented 4 weeks ago

Hi @selhagani,

I have tried it with the latest version 17.0.12, but no luck. Its still throwing the same warning.

selhagani commented 3 weeks ago

Could you please create a github repo containing the reducer alongside the steps needed to reproduce the issue? Unfortunately we cannot use the zip file you provided since it's against our policy. Thank you!

G33RY commented 3 weeks ago

Yes, sorry I did not know that! Here is the github repo (I even included the wildfly itself) https://github.com/G33RY/graalvm-test

selhagani commented 2 weeks ago

Hi @G33RY,

I'm trying to reproduce the issue but I keep getting a different error. Could you please share the steps you used to reproduce the issue please?

Thank you

G33RY commented 2 weeks ago

I am sorry. Here is a detailed step by step description: Firstly I am using Intellij Idea.

  1. Open the project folder as a maven project. (I placed the src,pom.xml in the "project" folder because intellij was slow opening the whole project, I commited the change)
  2. Edit run configuration and add JBoss/Wildfly Server - Local
  3. Configure Application servers -> Add -> Select the included wildfly26 folder
  4. On the deployment tab (Run Config)-> Add -> Artifact -> testgraalvm:war
  5. Now run the server
  6. Go to this url: http://localhost:8080/testgraalvm/HelloWorld
  7. The server log should show the warning
selhagani commented 2 weeks ago

Thank you for the information you provided. I managed to reproduce the issue you're facing. We'll take a closer look into this and I'll make sure to keep updated.

selhagani commented 1 week ago

Hi @G33RY,

Since you are using GraalVM and Truffle prior to 23.1 you need to install Graal.js using GU (Graal Updater) It is not supported to put Graal.JS on the classpath

G33RY commented 1 week ago

Hi @selhagani ,

Maybe I am doing something wrong, but it's not working.

  1. I have ran this command with the same graalvm jdk: gu install js
  2. Removed the graal.js from the classpath
  3. Run maven clean

I get this error:

No language and polyglot implementation was found on the classpath. Make sure the truffle-api.jar is on the classpath.

When I upgrade my graalsdk to 23.1.4 it gives me this:

 No language and polyglot implementation was found on the module-path. Make sure at last one language is added to the module-path
selhagani commented 1 week ago

Did you try to add the maven dependency for truffle? you can find it here

G33RY commented 1 week ago

Okay I got a different error:

A language with id 'js' is not installed. Installed languages are: [].

Thats strange because Wildfly starts with these config params:

JBoss Bootstrap Environment

JBOSS_HOME: /Users/G33RY/Projects/testgraalvm/wildfly26

JAVA: /Users/G33RY/Library/Java/JavaVirtualMachines/graalvm-ce-17.0.12/Contents/Home/bin/java

JAVA_OPTS:  -server -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64177,suspend=y,server=n -javaagent:/Users/G33RY/Library/Caches/JetBrains/IntelliJIdea2024.2/captureAgent/debugger-agent.jar -Dkotlinx.coroutines.debug.enable.creation.stack.trace=false -Ddebugger.agent.enable.coroutines=true   --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.url.ldaps=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED -Djava.security.manager=allow

I ran this command to be exact:

/Users/G33RY/Library/Java/JavaVirtualMachines/graalvm-ce-17.0.12/Contents/Home/bin/gu install js

Result:

Downloading: Artifacts catalog from gds.oracle.com
Processing Component: Graal.js
Component Graal.js (org.graalvm.js) is already installed.

And when I run gu list

ComponentId              Version             Component name                Stability                     Origin 
---------------------------------------------------------------------------------------------------------------------------------
graalvm                  23.0.5              GraalVM Core                  Supported                     
icu4j                    23.0.5              ICU4J                         Supported                     gds.oracle.com
js                       23.0.5              Graal.js                      Supported                     gds.oracle.com
native-image             23.0.5              Native Image                  Early adopter                 
regex                    23.0.5              TRegex                        Supported                     gds.oracle.com

I have searched solutions for this and everyone said that I should run the gu install js command. I have already ran this command, so I don't know why it's not installed.