tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shimon Crown <shimon.cr...@equipnet.co.il>
Subject Re: REPOST (+more comments) - Classloading problems with JNI
Date Thu, 08 Aug 2002 07:56:24 GMT
Hi Andreas,

Thanks but I was just being careless and wrote WEB-INF in the wrong case in
the post. Of course in the actual Tomcat hierarchy it is WEB-INF.
In any case I don't actually ever refer to WEB-INF in my code as it is
implicit that Tomcat can find classes there.

Curiously Windows Explorer "corrects" names like WEB-INF to Web-inf in its
displays so I have an excuse for my carelessness.

Shimon

----- Original Message -----
From: Andreas Probst <andpro77@gmx.net>
To: Shimon Crown <shimon.crown@equipnet.co.il>; Tomcat Users List
<tomcat-user@jakarta.apache.org>
Sent: Thursday, August 08, 2002 10:37 AM
Subject: Re: REPOST (+more comments) - Classloading problems with JNI


> 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.
>
> Andreas
>
>
> > 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:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
> >
>
>


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


Mime
View raw message