tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Probst" <>
Subject Re: REPOST (+more comments) - Classloading problems with JNI
Date Thu, 08 Aug 2002 07:37:48 GMT
Hi Shimon,

I don't know about JNI, but maybe it only has to do with the spelling of WEB-INF. It 
must be written in upper case.


> I asked this question a couple of days ago but only got 1 reply which
> unfortunately didn't solve the problem. Hence the repost.
> Tomcat 4.0.  J2SDK1.4 (Windows NT4).
> I have a couple of jars that use JNI. Originally I put these jars into the
> applications web-inf directory. Presumably these classes were only loaded
> once as everything went okay as far as calling from java to C++ code goes.
> The native code performs a callback into classes defined in these jars and
> has to create java classes defined by me. Unfortunately the native dll is
> unable to locate these classes and I fail in the native line
>      jclass variantClass = env->FindClass("MYCLASS");
>  The same thing happens when I put the JNI jars in %CATALINA_HOME%/lib which
> I believe is the correct place for them.
> I have tried other directories including  %CATALINA_HOME%\server\lib. When
> using these other directories it seems that the JNI classes are loaded twice
> as Tomcat just hangs and fails to initialize the servlets that I have setup
> to load at startup.
>  I tried the same thing with jetty web server and found that JNI is unable
> to find classes in the web-inf/lib directory. However if I included these
> JNI containing jars as part of the classpath that I gave when running the
> Jetty server then it could find them.
> As an interim solution I have found that I can split the problem causing
> jars into Java->C++ calling and other classes. The other classes which are
> called from C++ can safely be put in a common CATALINA directory where the
> classloader used by JNI will find them.
> Can anyone provide me with a definitive explanation of the classloading
> behaviour I am seeing. Is there a way to solve this problem without breaking
> up the jars ?
> Shimon Crown
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message