You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Astrid Wagner <As...@motorola.com> on 2003/09/15 15:10:39 UTC
java.lang.UnsatisfiedLinkError
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
Re: java.lang.UnsatisfiedLinkError
Posted by Tim Funk <fu...@joedog.org>.
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
Re: java.lang.UnsatisfiedLinkError
Posted by Astrid Wagner <As...@motorola.com>.
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
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: java.lang.UnsatisfiedLinkError
Posted by Tim Funk <fu...@joedog.org>.
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
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
Re: java.lang.UnsatisfiedLinkError
Posted by Astrid Wagner <As...@motorola.com>.
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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org