-
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
JNA fails to load with GraalVM throwing JNA: Problems loading core IDs: java.lang.Object #2261
Comments
I commented on the JNA side: I think the reflection/jni configuration is missing a huge number of types/methods/fields, that are needed at runtime. |
@matthiasblaesing thanks finally after a sleepless week I have figured out all the needed JNA metadata for GraalVM and now it's working perfectly, it was a lot of fiddling through the JNA code and tracing it back to the errors. |
@amahfouz1 Can you pass this on ? I have the same problem |
@MuriloFtto I am working on contributing a full JNA configuration sample for GraalVM will let you know once it's ready. |
I'm very interested in your findings. Are you still planning on writing that sample or maybe have even published it already somewhere? Thanks! |
@dennisdietrich @MuriloFtto Please find my sample code here https://github.com/amahfouz1/jna-graalvm sorry for the delay. |
I know JNA is not supported out of the box on GraalVM and there are some issues closed with that conclusion but still, I tried to see if I can find a workaround. When JNA initializes during build time it never works during the runtime. I differed it to initialize at runtime and had all the resources and I started feeling there is a light at the end of the tunnel but unfortunately JNA failed when it's booting up and loading the libjnidispatch.so library it fails with: JNA: Problems loading core IDs: java.lang.Object (It's basically ClassNotFoundException)
This is the line throwing this error: https://github.com/java-native-access/jna/blob/e6ab3ecdfa5482b41230fc28888df22da4d15bd4/native/dispatch.c#L3267.
Not sure why it's not able to load Java.Lang.Object why it's not available at that time within the SubstrateVM image. I opened a similar ticket on JNA side java-native-access/jna#1172 and I am trying to connect the dots to see what we can do to help as a community to contribute to get JNA working it's very crucial for so many existing Java native libraries.
Steps to reproduce:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b06)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 25.242-b06-jvmci-20.0-b02, mixed mode)
Repo: https://github.com/amahfouz1/clj-pcap-native
I have a Dockerfile handy in the repo to help to build the image.
The libjndispatch.so is found and the C code is now started executing but it fails :(
JNA it seems like it's not able to run the basic JVM classes within the SubstrateVM image.
The text was updated successfully, but these errors were encountered: