You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shimon Crown <sh...@equipnet.co.il> on 2002/08/05 15:14:42 UTC

Classloading problems with JNI

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. 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 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.

Any suggestions.

Shimon Crown