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

Could not initialize class org.graalvm.polyglot.Engine$ImplHolder #8587

Open ljy1058318852 opened 7 months ago

ljy1058318852 commented 7 months ago

ERROR:

java.lang.IllegalAccessError: superclass access check failed: class com.oracle.truffle.polyglot.PolyglotImpl (in unnamed module @0x559dfc35) cannot access class org.graalvm.polyglot.impl.AbstractPolyglotImpl (in module org.graalvm.polyglot) because module org.graalvm.polyglot does not export org.graalvm.polyglot.impl to unnamed module @0x559dfc35
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:534)
    at java.base/java.lang.Class.forName(Class.java:513)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1217)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
    at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
    at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine.loadAndValidateProviders(Engine.java:1627)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$1.run(Engine.java:1712)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$1.run(Engine.java:1707)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:1707)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$ImplHolder.<clinit>(Engine.java:190)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine.getImpl(Engine.java:442)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$Builder.build(Engine.java:740)
    at org.graalvm.polyglot/org.graalvm.polyglot.Context$Builder.build(Context.java:1925)
    at org.graalvm.polyglot/org.graalvm.polyglot.Context.create(Context.java:979)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.utils.DeserializerUtils.serializeParsing(DeserializerUtils.java:22)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.utils.DeserializerUtils.serializeCheck(DeserializerUtils.java:71)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.utils.aesUtils.decrypt(aesUtils.java:164)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.content.blueTeam.casDecrypt.decrypt(casDecrypt.java:46)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.content.blueTeam.webShellDecrypt.bodyDecrypt(webShellDecrypt.java:218)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.content.blueTeam.webShellDecrypt.dealBody(webShellDecrypt.java:114)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.controller.PaneWebshellDecode$3.call(PaneWebshellDecode.java:348)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.controller.PaneWebshellDecode$3.call(PaneWebshellDecode.java:341)
    at javafx.graphics@21.0.2/javafx.concurrent.Task$TaskCallable.call(Task.java:1399)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.lang.Thread.run(Thread.java:1583)
java.lang.NoClassDefFoundError: Could not initialize class org.graalvm.polyglot.Engine$ImplHolder
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine.getImpl(Engine.java:442)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$Builder.build(Engine.java:740)
    at org.graalvm.polyglot/org.graalvm.polyglot.Context$Builder.build(Context.java:1925)
    at org.graalvm.polyglot/org.graalvm.polyglot.Context.create(Context.java:979)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.utils.DeserializerUtils.serializeParsing(DeserializerUtils.java:22)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.utils.DeserializerUtils.serializeCheck(DeserializerUtils.java:71)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.utils.aesUtils.decrypt(aesUtils.java:164)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.content.blueTeam.casDecrypt.decrypt(casDecrypt.java:46)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.content.blueTeam.webShellDecrypt.bodyDecrypt(webShellDecrypt.java:218)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.content.blueTeam.webShellDecrypt.dealBody(webShellDecrypt.java:114)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.controller.PaneWebshellDecode$3.call(PaneWebshellDecode.java:348)
    at com.potato.potatotool@1.0-SNAPSHOT/com.potato.potatotool.controller.PaneWebshellDecode$3.call(PaneWebshellDecode.java:341)
    at javafx.graphics@21.0.2/javafx.concurrent.Task$TaskCallable.call(Task.java:1399)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.IllegalAccessError: superclass access check failed: class com.oracle.truffle.polyglot.PolyglotImpl (in unnamed module @0x559dfc35) cannot access class org.graalvm.polyglot.impl.AbstractPolyglotImpl (in module org.graalvm.polyglot) because module org.graalvm.polyglot does not export org.graalvm.polyglot.impl to unnamed module @0x559dfc35 [in thread "Thread-5"]
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:534)
    at java.base/java.lang.Class.forName(Class.java:513)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1217)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
    at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
    at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
    at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine.loadAndValidateProviders(Engine.java:1627)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$1.run(Engine.java:1712)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$1.run(Engine.java:1707)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:1707)
    at org.graalvm.polyglot/org.graalvm.polyglot.Engine$ImplHolder.<clinit>(Engine.java:190)

calling code:

import org.graalvm.polyglot.Context;
Context context = Context.create();
String jsCode = getResourceString("JavaStream");
context.eval("js", jsCode);

Project framework : Javafx java jdk : 17 My MVN configuration :

<dependency>
            <groupId>org.graalvm.sdk</groupId>
            <artifactId>graal-sdk</artifactId>
            <version>23.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>23.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <version>23.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.truffle</groupId>
            <artifactId>truffle-api</artifactId>
            <version>23.1.2</version>
        </dependency>
ljy1058318852 commented 7 months ago

@chumer God, help me

SenkJu commented 7 months ago

I have the same issue.

bios64 commented 4 months ago

Same here!

nicolasrvivas commented 3 months ago

Same here!

ljy1058318852 commented 3 months ago

I have no problem now, but I don't remember the reason. I have downgraded the version and now I am using 22.3.5 `

org.graalvm.sdk graal-sdk 22.3.5

org.graalvm.js js 22.3.5 org.graalvm.js js-scriptengine 22.3.5 ` I still remember that I had a conflict with the regular parser and other packages at the time, and it was resolved afterwards. I don't remember if it had anything to do with this I hope it can help you
JiananAlvin commented 2 months ago

Same issue here. 🥹

chumer commented 3 weeks ago

Sorry for the delay.

The problem is likely:

        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>23.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.truffle</groupId>
            <artifactId>truffle-api</artifactId>
            <version>23.1.2</version>
        </dependency>

There are two incompatible versions of JS and Truffle. Please only use the same version for both. See: https://www.graalvm.org/latest/reference-manual/embed-languages/#dependency-setup

chumer commented 3 weeks ago

I have a hard time reproducing this. My sample pom does not fail:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.graalvm.test</groupId>
    <artifactId>basic-embedding</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.graalvm.sdk</groupId>
            <artifactId>graal-sdk</artifactId>
            <version>23.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>23.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <version>23.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.truffle</groupId>
            <artifactId>truffle-api</artifactId>
            <version>23.1.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

There must be something wrong with the Java command line. Can someone having this issue please share their full Java command line? Thanks!