You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Walters <sc...@integra-online.com> on 2002/06/27 23:32:59 UTC

specifying ClassLoader for webapp

Hi,

I've written a JNI based layer for a large 
native code executable to allow extensions 
to the native code application to be 
written in Java. When the executable 
starts, it creates a Java VM and loads 
several infrasturcture Java classes.  
These classes load a shared library as 
part of their initialization which allow 
the Java extension code to call back into 
the native code.  All this has worked very 
well.  

I've also embedded Tomcat 4.0.3 into the 
application successfully using the 
CatalinaService class.  I'm running into a 
problem though, when I try to use the 
infrastructure classes from my jsp bean to 
make calls back into the native code.  
Since my initial ClassLoader from when I 
created the Java VM has already loaded the 
shared library,  I get the following 
error...

javax.servlet.ServletException: Native 
Library F:\Java\DLL\JNIXfer.dll already 
loaded in another classloader

Is there a way to enable Tomcat's webapp 
classloader to find these infrastructure 
classes that were already loaded by the 
other Classloader?  I tried setting the 
parent loader in the Catalina class to my 
initial loader but that didn't seem to 
have any effect.  I don't mind making 
minor Tomcat source changes if that's what 
it takes to fix it.

Thanks,
Scott Walters









--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: specifying ClassLoader for webapp

Posted by Scott Walters <sc...@integra-online.com>.
I fixed my problem by moving the jars that 
load the native shared library into the 
lib/ext path of my jre.  I found a very 
good explanation of these issues in a pdf 
file that describes using the boot 
classpath at 
www.javageeks.com/Papers/BootClasspath/Boo
tClasspath.pdf

Scott

6/27/02 3:32:59 PM, Scott Walters 
<sc...@integra-online.com> wrote:

>Hi,
>
>I've written a JNI based layer for a 
large 
>native code executable to allow 
extensions 
>to the native code application to be 
>written in Java. When the executable 
>starts, it creates a Java VM and loads 
>several infrasturcture Java classes.  
>These classes load a shared library as 
>part of their initialization which allow 
>the Java extension code to call back into 
>the native code.  All this has worked 
very 
>well.  
>
>I've also embedded Tomcat 4.0.3 into the 
>application successfully using the 
>CatalinaService class.  I'm running into 
a 
>problem though, when I try to use the 
>infrastructure classes from my jsp bean 
to 
>make calls back into the native code.  
>Since my initial ClassLoader from when I 
>created the Java VM has already loaded 
the 
>shared library,  I get the following 
>error...
>
>javax.servlet.ServletException: Native 
>Library F:\Java\DLL\JNIXfer.dll already 
>loaded in another classloader
>
>Is there a way to enable Tomcat's webapp 
>classloader to find these infrastructure 
>classes that were already loaded by the 
>other Classloader?  I tried setting the 
>parent loader in the Catalina class to my 
>initial loader but that didn't seem to 
>have any effect.  I don't mind making 
>minor Tomcat source changes if that's 
what 
>it takes to fix it.
>
>Thanks,
>Scott Walters
>
>
>
>
>
>
>
>
>
>--
>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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>