Title: Tomcat, JNI and HP-UX
I have some tips from experience with both Win32 and AIX platforms. I'm assuming that HP UK C dynamic link libraries are built similar to AIX ones...?
 
- JDK 1.18 uses JNI version 1.0 bindings by default. Use the -jni option with javah to create a JNI 1.1 style C headers. These are easier to link with.
- Make sure you use the generated header for the basis of the function implementation (rather than copying by hand). This will ensure you get the function header exactly right.
- The unsatified link exception can occur for many reasons: the library is not found (not on the LIBPATH for instance), the method wasn't resolved (not exported or wrong signature in C)
 
Given the following java class with natic methods:
 
package  a.b;
 
public class c {
   public native void doSomething() {} 
   public native void doSomethingElse() {} 
}
 
You will need an export file with your so/shared library/DLL containing the mangled function prototypes, For example, in foo.exp ( the export file for the library foo.so ) I have: -
 
Java_a_b_c_doSomething
Java_a_b_c_doSomethingElse
 
This is the JNI 1.1 C export for the above java code.
-----Original Message-----
From: Eric Lee (LYN) (EUS) [mailto:[EMAIL PROTECTED]]
Sent: 05 December 2000 14:45
To: '[EMAIL PROTECTED]'
Subject: Tomcat, JNI and HP-UX

I am using Tomcat 3.1 on HP-UX 10.20 with Java version ("HP-UX Java C.01.18.03 05/12/2000 16:31:36 hkhd02") I am attempting to use a servlet that instantiates a class that contains JNI methods and I keep getting java.lang.UnsatisfiedLinkError exceptions when these native methods are accessed. The JNI methods execute fine from the command line with Java interpreter, I also know that the servlet is loading the shared library.  There are similar postings in the mailing list archives but they are without response.  If anyone has any comments, I sure would appreciate them.

Many Thanks,
Eric Lee

Reply via email to