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.28k stars 1.63k forks source link

ExceptionInInitializerError InvalidPathException on Windows, Apache Tomcat #8078

Open hatanaka-akihiro opened 9 months ago

hatanaka-akihiro commented 9 months ago

J2EE app using GraalJS, fails to initialize ScriptEngine when running on Apache Tomcat and Windows.

I'll paste the stack trace at the end; I've partially erased the Windows path part.

Here is a simple app that I have tested. https://github.com/hatanaka-akihiro/graaljs-test

ScriptEngine engine = manager.getEngineByName("js"); The value of engine is null, but when I checked, I found an error java.lang.ExceptionInInitializerError.

I think it is similar to the following two issues. https://github.com/oracle/graal/issues/469 https://github.com/oracle/graaljs/issues/534

Describe GraalVM and your environment:

hatanaka-akihiro commented 9 months ago

The value of engine is null, but when I checked, I found an error java.lang.ExceptionInInitializerError.

I set the break point at the below and checked Throwable.

org.graalvm.polyglot.Engine

    static AbstractPolyglotImpl getImpl() {
        try {
            return ImplHolder.IMPL;
        } catch (NoClassDefFoundError e) {
            // Workaround for https://bugs.openjdk.java.net/browse/JDK-8048190
            Throwable cause = initializationException;
            if (cause != null && e.getCause() == null) {
                e.initCause(cause);
            }
            throw e;
        } catch (Throwable e) {
            initializationException = e;    // <- this point
            throw e;
        }
    }
hatanaka-akihiro commented 5 months ago

https://github.com/hatanaka-akihiro/graaljs-test

After changing GraalJS 23.1.1 to 24.0.1, I no longer encounter the bug.