You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Read <ma...@roe.ac.uk> on 2004/07/16 16:50:01 UTC

JNI & Tomcat

Hi

I'm trying to call a JNI package from a Tomcat servlet.
I thought I had this working but I got in a mess the last couple of
days and reinstalled my webapp and it's not behaving as before
but I can't find what's different (I must have forgotten something
but....).

The package and shared object are jniast.jar and libjniast.so.
I've placed jniast.jar in CATALINA_HOME:/share/lib and
libjniast.so in my /home/mar/lib

I've set JAVA_OPTS to point the java.library.path to /home/mar/lib.

On starting Tomcat my servlet in webapps named SSA (which uses
jniast) works fine. However if I do a reload of SSA via the html manager
and re-run the servlet I get
java.lang.UnsatisfiedLinkError: Can't load library:
/net/graemsay/scratch/mar/jakarta-tomcat-4.1.30/webapps/ssa/lib/i386/libjniast.so
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1371)
	at java.lang.Runtime.load0(Runtime.java:737)
	at java.lang.System.load(System.java:809)
	at uk.ac.starlink.util.Loader.loadLibrary(Loader.java:130)
	at uk.ac.starlink.ast.AstObject.<clinit>(AstObject.java:45)
	at net.mar.ImageSelect.setRS(ImageSelect.java:63)
	at Image.doGet(HelloWorld.java:145)
	at javax.servlet.http.HttpServlet.service(HttpServlet.jav
        ......

This is not surpising as the libjniast.so isn't there but why is it even
looking there? Note its looking in SSA/lib not even SSA/WEB-INF/lib.

If I create the directories and copy the libjniast.so file in
it progresses a bit but complains of missing classes. If I copy
my other jars from SSA/WEB-INF/lib into SSA/lib/ the reload
works but only once! If a reload a 2nd time and then use the servlet
I get class already loaded errors.

I'm stumped.

Hoping someone can help.

Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org