-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[GR-62394] Espresso: "java.lang.NoSuchMethodError: getMainType" was thrown when running a Java-11 application #10694
Comments
Hi @shiaoguo, Thank you for reaching out!
If this fails with the same NoSuchMethodError, the issue is likely related to your Espresso setup. If Hello World works, but James Mail Server still fails, then the issue may be due to James and we might need to investigate further. |
Hi @selhagani , Thanks for your reply!
and the same error happened. Also, I've tried these commands: Command:
Output:
Command:
Output:
Command:
Output:
I'm new to Espresso and set it up according to https://www.graalvm.org/latest/reference-manual/espresso/. Maybe I've missed something important? Thank you again for the advice and looking forward to your reply! |
Could you please try running the same example except this time instead of compiling using java-11-openjdk-amd64 use GraalVM for jdk 21 instead? |
Doing so, I got these results: Command:
Output:
Command:
Output:
Command:
Output:
|
Thank you for sharing the results with me. We will take a closer look into this and I'll make sure to keep you updated. |
Thanks. By the way, is |
Regarding the issues with "class file version 65.0", you should use JDK 11 to compile this HellowWorld if you want to run it on JDK 11.
In an embedding scenario, where you setup a polyglot context programmatically, using the When using the standard espresso standalone this could work but as the Regarding you initial issue ( You can create a "JDK 11 espresso standalone" yourself though: # copy the JDK, dereferencing links to make it "standalone"
$ cp -L -r /usr/lib/jvm/java-11-openjdk jdk11
# add espresso library and files from the JDK 21 espresso standalone
$ cp -r graalvm-espresso-jdk-21.0.2+13.1/languages/ jdk11/
$ cp -r graalvm-espresso-jdk-21.0.2+13.1/lib/truffle/ jdk11/lib/
# edit jdk11/lib/jvm.cfg and add `-truffle KNOWN` as the first line
$ vim jdk11/lib/jvm.cfg
$ jdk11/bin/java -version
[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[java] SEVERE: Configuration specified a Java version incompatible with the pre-initialized language - expected: 21, got: 11.
openjdk version "11.0.26" 2025-01-21
OpenJDK Runtime Environment (Red_Hat-11.0.26.0.4-1) (build 11.0.26+4)
Espresso 64-Bit VM (Red_Hat-11.0.26.0.4-1) (build 11-espresso-24.1.2, mixed mode)
$ jdk11/bin/javac HelloWorld.java
[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[java] SEVERE: Configuration specified a Java version incompatible with the pre-initialized language - expected: 21, got: 11.
$ jdk11/bin/java HelloWorld
[To redirect Truffle log output to a file use one of the following options:
* '--log.file=<path>' if the option is passed using a guest language launcher.
* '-Dpolyglot.log.file=<path>' if the option is passed using the host Java launcher.
* Configure logging using the polyglot embedding API.]
[java] SEVERE: Configuration specified a Java version incompatible with the pre-initialized language - expected: 21, got: 11.
Hello, Espresso! This warning it's printing is a bit annoying but it does run the workload with JDK 11. |
Hi,
I'm trying to run James 3.6.2 (Java Apache Mail Enterprise Server) using Espresso. I built the James project upon OpenJDK11, so I ran it with
--java.JavaHome
pointing to the OpenJDK11. However, I got the following error:Even if I ran a simple program printing "Hello World", the same error happened. I'm wondering how to fix it.
Thanks a lot.
Environment:
Ubuntu 20.04
espresso-java21-24.1.2-linux-amd64
OpenJDK 11
The text was updated successfully, but these errors were encountered: