Loading IBM GNR native lib in JBoss EAP throws UnsatisfiedLinkError when loadLibrary is called from application and JNI classes are in JBoss lib

Solution Verified - Updated -

Issue

  • We are trying to load IBM GNR native lib from a web application, but it is not loading all of the required libraries, but when launched from a standalone java process, it works fine.

I have put the JNI jars in the $JBOSS_HOME/server/$PROFILE/lib and set these JAVA_OPTS in my $JBOSS_HOME/bin/run.conf, but getting an UnsatisfiedLinkError as shown below.

export LD_LIBRARY_PATH="/opt/IBM/GNM/lib64"
JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$LD_LIBRARY_PATH -verbose:jni -Xcheck:jni"
java.lang.UnsatisfiedLinkError: com.ibm.gnr.nws.scoringSWIGJNI.swig_module_init()V
    com.ibm.gnr.nws.scoringSWIGJNI.swig_module_init(Native Method)
    com.ibm.gnr.nws.scoringSWIGJNI.<clinit>(Unknown Source)
    com.ibm.gnr.nws.ScoringDirector.<init>(Unknown Source)
    com.ibm.gnr.nws.Scoring.<init>(Unknown Source)
    com.jboss.servlet.test.TestGNR.doGet(TestGNR.java:34)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        ...

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.