Operating System - HP-UX
1753846 Members
7622 Online
108807 Solutions
New Discussion юеВ

Web services, Tomcat 5, JNI and HP-UX - UnsatisfiedLinkError

 
d1camero
New Member

Web services, Tomcat 5, JNI and HP-UX - UnsatisfiedLinkError

I am running Web Services on Tomcat 5.0 on HP-UX. I am interfacing a very simple web service to a C program with JNI (JVM 1.4.2). The web service works just fine. I followed all the instructions on the HP web site on how to create a JNI C program (http://www.hp.com/products1/unix/java/infolibrary/prog_guide/JNI_java2.html
) , compiled it into a shared library and export the SHLIB_PATH so java can reference the library. When I try to run the C program from the web service, I get this error in the logfile:

java.lang.UnsatisfiedLinkError: no LearnerInquiry in java.library.path

This is the Java wrapper which calls the C program, the error points to the loadLibrary method:

package HughSFSBridge;
public class CISAMDataAccess {
static {
System.loadLibrary("LearnerInquiry");
}
public native String LearnerInquiry(String aSIN);

}



* SHLIB_PATH is set to SHLIB_PATH=/home/tomcat/tomcat-jwsdp-1.4/lib
* The name of the library is called LearnerInquiry.sl


Here is what I have tried:

- the library is executable
- set & export SHLIB_PATH in the shell and run tomcat from the shell
- set & export LD_LIBRARY_PATH is the shell and run tomcat
- modify catalina.sh to have -Djava.library.path="$SHLIB"
- put the library file in the tomcat /bin directory
- I do **not** have access to the java lib directory, nor should I. This library should only be available to tomcat.

Here are some things I suspect:
- TOMCAT does not pay attention to the SHLIB_PATH
- setting SHLIB_PATH on the command line does not allow tomcat to get access to it
- the package name in the Java wrapper (above) causes name issues

Any suggestions?
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: Web services, Tomcat 5, JNI and HP-UX - UnsatisfiedLinkError

Suggestions:
Set SHLIB_PATH in the startup script for your application and Tomcat.

Meke sure the actual object is on the SHLIB_PATH.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Senthilmurugan
Frequent Advisor

Re: Web services, Tomcat 5, JNI and HP-UX - UnsatisfiedLinkError

Hello,

Sometimes assigning the path to the SHLIB_PATH or LD_LIBRARY_PATH or anyother Variables and exporting them may not function properly. In that situations try to create links to the shared file and copy the link file in the PATH that is accessible to JVM.


Regards,
Senthi Murugan

d1camero
New Member

Re: Web services, Tomcat 5, JNI and HP-UX - UnsatisfiedLinkError

Thanks for the quick response. There were two problems:

1. set SHLIB_PATH to the directory which contains the shared library

2. prefix the name of the shared library with "lib"

So if the library was called Queer in the /home/fubar directory:

Path: SHLIB_PATH=/home/fubar
Lib name: libQueer.sl
Java call: System.loadLibrary("Queer")


d1