graaljs icon indicating copy to clipboard operation
graaljs copied to clipboard

URLClassLoader and GraalVM

Open dbschema-pro opened this issue 3 years ago • 1 comments

I wrote a Driver which is using GraalVM JS. The driver is loaded into an application using URLClassLoader. This line of code from the driver is getting an exception

Context.newBuilder("js").allowAllAccess(true).build();

exception

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

I tried also

Context.newBuilder("js").hostClassLoader(urlClassLoader).allowHostClassLoading(true).allowAllAccess(true).build();

and didn't work

In Gradle.properties I use :

implementation 'org.graalvm.js:js:22.2.0'
implementation 'org.graalvm.js:js-scriptengine:22.2.0'

and tried also 
implementation "org.graalvm.sdk:graal-sdk:22.0.0.2"
implementation "org.graalvm.truffle:truffle-api:22.0.0.2"

I checked, and the truffle.jar is in passed to the URLCLassLoader. How can I fix this?

dbschema-pro avatar Aug 08 '22 08:08 dbschema-pro

Hi, could you please share a reproducer code for this?

oubidar-Abderrahim avatar Aug 15 '22 08:08 oubidar-Abderrahim

Duplicates https://github.com/oracle/graal/issues/4814

oubidar-Abderrahim avatar Aug 16 '22 10:08 oubidar-Abderrahim