tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DHarty" <harty...@db.erau.edu>
Subject RE: JSP, JNI, classloader
Date Wed, 20 Jun 2001 21:33:17 GMT
I had many similar problems with JNI a while back.  I don't remember all the
details, but I remember that for some reason, any Java class that used JNI
could NOT be in a package.

I don't know if they ever provided a fix to this, but I removed all package
info from my JNI related java files, and everything began to work.

Good luck.

D

-----Original Message-----
From: Matthew Lerner [mailto:msl@continuum.continuumsi.com]
Sent: Wednesday, June 20, 2001 4:41 PM
To: tomcat-user@jakarta.apache.org
Subject: JSP, JNI, classloader


Apologies for being a clueless newbie, but I've been beating my head on
this for the last week.

I'm setting up a new webapp.  It needs to interact with a C++
library.  (There are reasons it needs to be in C++.  Really there
are.)  Since I've never done JSP or JNI before, I figured I'd get a
skeletal application going - all I'm trying to do is have a .jsp page
communicate with a C library.  So first I thought I'd better set up a Java
Bean and get my jsp talking to that, and then maybe I can see about talking
to JNI.  That first part went great.  Since I'd had trouble with it before,
I very carefully verified that recreating my .class file (in
ROOT/WEB-INF/classes) actually modified my bean.  I even managed to use
both get and set methods.  All was going well.

Then I added the native interface code to the bean:
     public native int getInt(int arg);

     static {
         System.loadLibrary("hello");
     }

I'd tested this code in a normal java application, and it worked
fine.  When I tried to load the Bean from JSP though, not only did it not
work (I failed to copy the error message, sorry), but it stopped reloading
the class when I recompile it.  Restarting Tomcat did not help.

So, first things first -- how do I get Tomcat to see new versions of the
class?

After that, anybody have pointers on how to get JSP to talk to JNI?

Thanks in advance
	Matthew Lerner


Mime
View raw message