-
Notifications
You must be signed in to change notification settings - Fork 1.7k
In graalvm-jdk-21.0.5+9.1, an unknown error occurs when running a simple Java program #10994
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
Comments
Hi @xwqmary, Thank you for reaching out to us! |
Hello @selhagani I also encountered this issue, have you got any leads into the cause of the problem? |
I tested the reproducer you shared with the latest versions of GraalVM for JDK 17 and for JDK 21. When using the latest versions, the output errors aren't that different. |
@selhagani Thank you very much for looking into this issue. The version I'm using is: |
Hi @xwqmary, Thank you for sharing the exact version with me. After conducting further testing, I don't believe this is a regression. In fact, if you add the following line to the code:
You’ll see that recursion does occur in all versions. |
Hi @selhagani |
Uh oh!
There was an error while loading. Please reload this page.
In graalvm-jdk-21.0.5+9.1, a Java program encounters an unexpected java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules despite the class B1903 being successfully loaded at startup by the system class loader (AppClassLoader). The program uses a custom ClassLoader to load B1903 and invokes its main method via reflection, leading to limited recursion before failing with this error. Since B1903 is already loaded as the entry point class, the NoClassDefFoundError seems unjustified. In contrast, the same code on graalvm-jdk-17 runs as expected, entering full recursion and throwing StackOverflowError without this issue.
Steps to reproduce the issue
testcase
graalvm-jdk-21.0.5+9.1/bin/javac B1903.java
graalvm-jdk-21.0.5+9.1/bin/java B1903
output:
On graalvm-jdk-17, the same code recurses fully until a StackOverflowError, as expected. In graalvm-jdk-21.0.5+9.1, the recursion stops prematurely with NoClassDefFoundError, referencing StackTraceElement$HashedModules. Since B1903 is already loaded and accessible, this error is unexpected and suggests a failure in an internal JVM class during recursion, not a problem with B1903 itself. I believe this could indicate a latent issue in GraalVM JDK 21, possibly related to stricter runtime checks or a regression in handling recursive reflection calls.
The text was updated successfully, but these errors were encountered: