tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leon Liu" <laiy...@hotmail.com>
Subject RE: JNI & Tomcat
Date Mon, 31 Jul 2000 15:47:10 GMT
Hi, I met exactly the same problem as Tom except I am running Tomcat under 
windows NT environment (I also tried to run it under Windows 2000 Advanced 
Server environment, but I got the same exception).

I have a dynamic link library which can be loaded by the system, but the JVM 
or Tomcat cannot get the right function inside the dll.

I tried to follow Tom's solution to move the wrapper-class to tomcat/classes 
directory, but still got the same exception.

Anybody has any good ideas? Thanks in advance.
Leon



>From: Amos Shapira <amos.shapira@webcollage.com>
>Reply-To: tomcat-user@jakarta.apache.org
>To: "'tomcat-user@jakarta.apache.org'" <tomcat-user@jakarta.apache.org>
>Subject: RE: JNI & Tomcat
>Date: Thu, 27 Jul 2000 12:31:57 +0300
>
>I suspect there is the matter of classloaders and protection
>domains which I haven't got around to fully understand, we
>put someone else here to try to understand the issue fully
>(in the light of the JNI problem).
>
>I can quite understand the need for differentiation among the
>various web applications.  Imagine two application from totally
>different sources (two dept. or two clients of some web app host)
>using the same class names, each expecting to use its own copy,
>classloaders allow them to do that without clashing on class
>implementations.  It's part of the whole Java protection scheme
>which bases what a piece of code is allowed based where it came
>from (which file or url) and who signed it.
>
>I'm interested to hear if anyone else can explain exactly the source
>of the "problem".
>
>Cheers,
>
>--Amos
>
> > -----Original Message-----
> > From: Thomas Bilz [mailto:thomas.bilz@xplain.de]
> > Sent: Thursday, July 27, 2000 12:25 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: RE: JNI & Tomcat
> >
> >
> > I got it, but I'm not very satisfied. The way I managed the
> > problem was to
> > move the wrapper-classes to the classpath
> > of tomcat: /usr/local/tomcat/classes. Not a very nice solution!?
> > I'm very surprised about this. I moved the files to WEB-INF/classes -
> > nothing happend - I moved them to WEB-INF/lib - nothing at
> > all - so last
> > possibility was to move them to tomcat/classes. I thought that
> > WEB-INF/classes of every context would be added to CLASSPATH,
> > but now I know
> > that's not true.
> >
> > So at last I'm not content with this solution, but it works,
> > 	Tom
> >
> > > -----Original Message-----
> > > From: Amos Shapira [mailto:amos.shapira@webcollage.com]
> > > Sent: Wednesday, July 26, 2000 7:24 PM
> > > To: 'tomcat-user@jakarta.apache.org'
> > > Subject: RE: JNI & Tomcat
> > >
> > >
> > > Hi,
> > >
> > > I'm not an expert on this stuff, but as I write this we are
> > > tackling a similar problem.  Two web applications share the
> > > same JNI file to lock files using a system call.  When the
> > > two used their own copies of the .class files under WEB-INF/classes
> > > (but the same DLL in the PATH) they complaint about the
> > shared object
> > > already being loaded by "the other application".  Removing
> > the .class
> > > files from one of them didn't help.  Moved the .class to a
> > > classpath defined for ServletExec (this is ServletExec 3.0 with
> > > IIS 5 under Windows 2000) and things startted rocking.
> > >
> > > I don't remember the exact errors we had there, but you might want
> > > to try moving the .class file to one of the "general" directories in
> > > the classpath (as opposed to a web-application-specific directory)
> > > and see what happens.
> > >
> > > As for finding classes under WEB-INF/classes, yes, my experience
> > > so far is that just putting a hierarchy there (or sticking
> > a .jar file
> > > under WEB-INF/lib) causes the classes to be automatically found
> > > by the servlet engine (I think it works both with Tomcat and
> > > ServletExec,
> > > and this is also the behaviour I infer from the Servlet 2.2 spec).
> > >
> > > Sorry I can't be more specific, hope this helps and I'm
> > still curious
> > > what happens with your problem.
> > >
> > > Cheers,
> > >
> > > --Amos Shapira
> > > WebCollage
> > >
> > > > -----Original Message-----
> > > > From: Thomas Bilz [mailto:thomas.bilz@xplain.de]
> > > > Sent: Wednesday, July 26, 2000 6:01 PM
> > > > To: tomcat-user@jakarta.apache.org
> > > > Subject: RE: JNI & Tomcat
> > > >
> > > >
> > > > I'll check it, but I don't think the dependencies are the
> > > > problem. Shouldn't
> > > > the dependencies be okay, when it works with jserv?
> > > >
> > > > In jserv I had to insert a line into the properties-file of
> > > > the apropriate
> > > > context:
> > > > 'wrapper.classpath=/export/home/inetroot/Focus/Inetroot/PM3DC/
> > > > classes' to
> > > > make the JNI find the interface-definitions.
> > > > In Tomcat it should be enough, to put these classes into
> > > > WEB-INF/classes of
> > > > the context. Am I right?
> > > > Do I have to insert special lines into web.xml?
> > > >
> > > > Once again: THX, Tom
> > > >
> > > > > -----Original Message-----
> > > > > From: Amos Shapira [mailto:amos.shapira@webcollage.com]
> > > > > Sent: Wednesday, July 26, 2000 11:33 AM
> > > > > To: 'tomcat-user@jakarta.apache.org'
> > > > > Subject: RE: JNI & Tomcat
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I use JNI with Tomcat, but on Windows 2000.  No problems so
> > > > > far, though
> > > > > I use Tomcat as stand-alone environment for development under
> > > > > JBuilder 3.5.
> > > > > (it also works with ServletExec 3.0 under IIS on
> > Windows 2000 and
> > > > > Windows NT).
> > > > >
> > > > > What I'd suggest you to double-check would be to see if
> > > > there are any
> > > > > unsatisfied dependencies for libNativeCalculator.so, use
> > > > > "ldd" (I think)
> > > > > to see if all its dependencies are resolved as well.
> > > > >
> > > > > Hope this helps,
> > > > >
> > > > > --Amos Shapira
> > > > > WebCollage
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Thomas Bilz [mailto:thomas.bilz@xplain.de]
> > > > > > Sent: Wednesday, July 26, 2000 11:46 AM
> > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > Subject: RE: JNI & Tomcat
> > > > > >
> > > > > >
> > > > > > You are right, on Solaris you'll have to place it in
> > > > > > LD_LIB.... So I placed
> > > > > > the file libNativeCalculator.so in /usr/local/lib, part of
> > > > > LD_LIB....
> > > > > > I think the library is found, because when I delete the
> > > > > > library common.so in
> > > > > > /usr/local/lib the error changes to:
> > > > > > -------------
> > > > > > java.lang.UnsatisfiedLinkError: no NativeCalculator in shared
> > > > > > library path
> > > > > > 	at java.lang.Throwable.(Compiled Code)
> > > > > > 	at java.lang.Error.(Compiled Code)
> > > > > > 	at java.lang.LinkageError.(Compiled Code)
> > > > > > 	at java.lang.UnsatisfiedLinkError.(Compiled Code)
> > > > > > 	at java.lang.Runtime.loadLibrary(Compiled Code)
> > > > > > 	at java.lang.System.loadLibrary(Compiled Code)
> > > > > > 	at
> > > > > > de.xplain.GenericCalculator.OutputParams.getErrorMessage(Compi
> > > > > > led Code)
> > > > > > 	at
> > > > > >
> > > > >
> > > >
> > >
> > de.xplain.GenericCalculator.Calculator.computeInternal(Compiled Code)
> > > > > > 	at
> > > de.xplain.GenericCalculator.Calculator.compute(Compiled Code)
> > > > > > 	at
> > > > > > de.xplain.GenericCalculator.Calculators.BarwertCalculator.comp
> > > > > > ute(Compiled
> > > > > > Code)
> > > > > >       .....
> > > > > > -------------
> > > > > > In my opinion the system can find the library, when it is
> > > > placed in
> > > > > > /usr/local/lib, but JVM can't
> > > > > > get the right function 'compute'.
> > > > > > Do you work with JNI and Tomcat? No problems in that?
> > > > > >
> > > > > > Thanks for spending your time on that problem,
> > > > > > 	Tom
> > > > > >
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Amos Shapira [mailto:amos.shapira@webcollage.com]
> > > > > > > Sent: Tuesday, July 25, 2000 7:18 PM
> > > > > > > To: 'tomcat-user@jakarta.apache.org'
> > > > > > > Subject: RE: JNI & Tomcat
> > > > > > >
> > > > > > >
> > > > > > > Hmm, how do you expect Tomcat to find the .so? (I
> > > assume this is
> > > > > > > UNIX).
> > > > > > >
> > > > > > > At least on Windows 2000, the .DLL files must be on the
PATH
> > > > > > > in order to be found by JNI, I think for Solaris it
> > is enough
> > > > > > > for them to
> > > > > > > be on LD_LIBRARYPATH (or somesuch).
> > > > > > >
> > > > > > > Hope this helps,
> > > > > > >
> > > > > > > --Amos Shapira
> > > > > > > WebCollage
> > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Thomas Bilz [mailto:thomas.bilz@xplain.de]
> > > > > > > > Sent: Tuesday, July 25, 2000 6:12 PM
> > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > Subject: JNI & Tomcat
> > > > > > > >
> > > > > > > >
> > > > > > > > Yesterday I installed Tomcat and most things seem
to work,
> > > > > > > > but I have a
> > > > > > > > problem with JNI in an old Servlet that ran on
> > JServ before.
> > > > > > > > I have a shared library, which is loaded, and I have
a
> > > > > > > > wrapper-class for it.
> > > > > > > > But I can't use this wrapper: every access to my servlet
> > > > > > ends with a
> > > > > > > > java.lang.UnsatisfiedLinkError.
> > > > > > > > -------------
> > > > > > > > Error: 500
> > > > > > > > Location: servlet/de.rechentools.servlets.Barwert
> > > > > > > > Internal Servlet Error:
> > > > > > > >
> > > > > > > > java.lang.UnsatisfiedLinkError: compute
> > > > > > > > 	at
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > de.xplain.GenericCalculator.Calculator.computeInternal(Compiled Code)
> > > > > > > > 	at
> > > > > de.xplain.GenericCalculator.Calculator.compute(Compiled Code)
> > > > > > > > 	at
> > > > > > > >
> > > de.xplain.GenericCalculator.Calculators.BarwertCalculator.comp
> > > > > > > > ute(Compiled
> > > > > > > > Code)
> > > > > > > > 	at
> > > > > > > >
> > > > de.rechentools.servlets.Barwert.createReplaceList(Compiled Code)
> > > > > > > > 	at
> > > > > > > >
> > > > >
> > de.xplain.GenericServlets.RechenModulServlet.doGet(Compiled Code)
> > > > > > > > 	at
> > > > > > > >
> > > > >
> > de.xplain.GenericServlets.RechenModulServlet.doPost(Compiled Code)
> > > > > > > > 	at javax.servlet.http.HttpServlet.service(Compiled
Code)
> > > > > > > > 	at javax.servlet.http.HttpServlet.service(Compiled
Code)
> > > > > > > > 	at
> > > > > > > >
> > > > >
> > org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
> > > > > > > > 	at
> > > > > org.apache.tomcat.core.ContextManager.service(Compiled Code)
> > > > > > > > 	at
> > > > > > > >
> > > org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> > > > > > > > cessConnection
> > > > > > > > (Compiled Code)
> > > > > > > > 	at
> > > > > > > >
> > > > org.apache.tomcat.service.TcpConnectionThread.run(Compiled Code)
> > > > > > > > 	at java.lang.Thread.run(Compiled Code)
> > > > > >
> > > > >
> > > >
> > >
> >

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message