tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: java.lang.UnsatisfiedLinkError
Date Mon, 15 Sep 2003 19:18:28 GMT
Each webapp is in its own class loader. Native code can doesn't care about 
classloaders. It only wants loaded once. Initializing can't really be done 
easily (if at all) in a webapp context. Move the code which does the shared 
native code to $CATALINA_HOME/common/lib

-Tim

Astrid Wagner wrote:

> Thanks for the hint.
> But I do not quite understand the proposal:
> 
> the shared libraries state should be reinitialized.
> 
> How do I do that?
> 
> Then:
> 
> Something which could help is to avoid putting classes which would be 
> referenced by a shared static field in the web application classloader, 
> and put them in the shared classloader instead (the JARs should be put 
> in the "lib" folder, and classes should be put in the "classes" folder).
> 
> ??
> 
> Maybe you can tell me what this means in my example.
> My webapps use the class IprShellInterface which is in a shared library 
> the following way:
>            String shellResponse = IprShellInterface.executeCommand(...);
> 
> Here a snippet from IprShellInterface.java:
> 
>  static {
> 
>     System.out.println("IprShellInterface@static: The library path is 
> set to: " +
>     System.getProperty("java.library.path"));
> 
>     try {
>        System.loadLibrary("IprShellInterface");
>        System.out.println("IprShellInterface@static: Done loading 
> library IprShellInterface");
>     }
>     catch (Exception e) {
>        System.out.println("IprShellInterface@static: Exception loading 
> library IprShellInterface ... "
> );
>        System.out.println(e.getMessage());
>     }
> 
>  public static String executeCommand(...)
> 
> 
> I compile the class into the shared library libIprShellInterface.so and 
> right now install it in lib of the DB installation (included in the 
> java.library.path variable).
> This means that all webapps take the same. If that is the reason for the 
> problem wouldn't it be a solution to
> install it into the different webapps lib directories:
> ./webapps/iprweb-iprdev1/WEB-INF/lib/libIprShellInterface.so
> ./webapps/iprweb-iprdev2/WEB-INF/lib/libIprShellInterface.so
> ./webapps/iprweb-iprdev3/WEB-INF/lib/libIprShellInterface.so
> 
> and have the java.library.path path be set individually for the webapps. 
> Or is there only one for all applications?
> Where do I set the library path anyway?
> Sorry I just have too little info about how this works ...
> 
> Thanks
> Astrid
> 
> 
> 
> Tim Funk wrote:
> 
>> See the RELEASE NOTES under the section of shared libraries ...
>>
>> http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-4.0/RELEASE-NOTES-4.1.txt?rev=1.79&content-type=text/vnd.viewcvs-markup

>>
>>
>> -Tim
>>
>> Astrid Wagner wrote:
>>
>>> Hi,
>>>
>>> Where do I set the java.library.path property for different webapps?
>>> Thanks.
>>>
>>> Astrid
>>>
>>> Astrid Wagner wrote:
>>>
>>>> Hi,
>>>>
>>>> I have three different web applications installed and running in 
>>>> three different modes (e.g. test, training )
>>>> but basically based on the same code otherwise. In all of them I use 
>>>> a native c library to call shell commands.
>>>> When I test one web app everything works fine.
>>>> When I switch to another web application I eventually receive the 
>>>> following error:
>>>>
>>>> root cause
>>>>
>>>> java.lang.UnsatisfiedLinkError: Native Library 
>>>> /home/oraedt/app/oracle/product/9iAS_1.0.2.2/lib/libIprShellInterface.so

>>>> already loaded in another classloader
>>>>        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1444)
>>>>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1404)
>>>>        at java.lang.Runtime.loadLibrary0(Runtime.java:772)
>>>>        at java.lang.System.loadLibrary(System.java:832)
>>>>
>>>>
>>>> I installed the shared library  libIprShellInterface.so  into the 
>>>> databases lib directory which is included in the library path
>>>> and where it is - normally - found.
>>>> Does anyone know why I receive this error and how I can solve this 
>>>> problem?
>>>> Thanks.
>>>> Astrid



Mime
View raw message