You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Sheridan <ja...@tecnomen.ie> on 2002/03/26 14:09:33 UTC

ClassCastException for JNI class loaded from common/lib

Hi,

I would be keen to get help on an issue with using JNI classes from multiple
webapps. I have 2 webapps both of which need to load a class which wraps JNI
code. According to the release notes it is a good idea to place the code
which loads the library (loadLibrary()) outside the webapps dir, so I put it
in common/lib.

When the first webapp attempts to instantiate the class, the native library
is loaded apparently successfully, but the following code throws a
ClassCastException
	myImpl = (myClass)Class.forName("name of class with
JNI").newInstance();

However the confusing thing is that this works find when the class is
installed in the webapps dir (<webapps>/WEB-INF/lib)  (though the second
webapp cannot load the library of course - cannot do 2 calls to
loadLibrary).

Has anyone done this before and if so could you please share with me the
magic I need to do to make it work ?

Thanks in advance,
	James

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>