Skip to content

JNA fails to load with GraalVM throwing JNA: Problems loading core IDs: java.lang.Object #1172

Closed
@amahfouz1

Description

@amahfouz1
  • Version of JNA : 5.3.1
  • Version and vendor of the java virtual machine:
    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)
  • Operating system: Oracle Linux 7 and Centos 7
  • System architecture (CPU type, bitness of the JVM) : x86_64
  • Complete description of the problem: JNA native lib fails to load with GraalVM:
    After generating a Linux native executable using GraalVM when JNA is booting up and loading the libjnidispatch.so library it fails with: JNA: Problems loading core IDs: java.lang.Object
    This is the line throwing this error:
    fprintf(stderr, "JNA: Problems loading core IDs: %s\n", err);

Steps to reproduce:
Repo: https://github.com/amahfouz1/clj-pcap-native

  • Build docker image:
    I have a Dockerfile handy in the repo to help to build the image.
cd clj-pcap-native
docker build -t clj-pcap .
  • Run docker image mounting the project:
docker run -it -v `pwd`:/clj-pcap clj-pcap /bin/sh
  • Generate native executable:
cd /clj-pcap
lein native-image
  • Run the executable:
/clj-pcap/target/default+uberjar/cljpcap -Djna.debug_load=true
sh-4.2# /clj-pcap/target/default+uberjar/cljpcap -Djna.debug_load=true
Mar 15, 2020 8:13:53 PM com.sun.jna.Native extractFromResourcePath
INFO: Looking in classpath from sun.misc.Launcher$AppClassLoader@16c0128 for /com/sun/jna/linux-x86-64/libjnidispatch.so
Mar 15, 2020 8:13:53 PM com.sun.jna.Native extractFromResourcePath
INFO: Found library resource at resourcew:com/sun/jna/linux-x86-64/libjnidispatch.so
Mar 15, 2020 8:13:53 PM com.sun.jna.Native extractFromResourcePath
INFO: Extracting library to /root/.cache/JNA/temp/jna2847104491610838225.tmp
JNA: Problems loading core IDs: java.lang.Object

The libjndispatch.so is found and the C code is now started executing and it fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions