You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josef Henryson <ja...@henryson.com> on 2004/07/07 21:03:54 UTC
UnsatisfiedLinkError - JNI
Hi!
I get an UnsatisfiedLinkError when trying to System.loadLibrary("foo")
from a class instantiated within a Servlet. The library libFoo.jnilib
is in a folder within java.library.path and the class loading it is
inside a JAR in $CATALINA_HOME/shared/lib. Beside the JNI library is a
native library libBar.dylib.
I'm running Tomcat 5.0.25 on Mac OS X 10.3.4
Here's the exception:
UnsatisfiedLinkError:
/Users/henryson/Library/Java/Extensions/libFoo.jnilib:
java.lang.UnsatisfiedLinkError:
/Users/henryson/Library/Java/Extensions/libFoo.jnilib:
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
I have tried loading the library from a small Java application outside
the Tomcat server and it works fine when all classes/libraries are
within the same folder.
Of course I have searched for a solution on Google and I have also
search old entries on this list (in an archive on a website) but there
just don't seem to be a solution available out there... =(
Anyone that have a clue? I would be VERY thankful =)
Regards,
Josef Henryson
Re: UnsatisfiedLinkError - JNI
Posted by Josef Henryson <ja...@henryson.com>.
See bottom of message...
On Jul 7, 2004, at 21:33, Tim Penhey wrote:
> Josef Henryson wrote:
>
>> Hi!
>>
>> I get an UnsatisfiedLinkError when trying to
>> System.loadLibrary("foo") from a class instantiated within a Servlet.
>> The library libFoo.jnilib is in a folder within java.library.path and
>> the class loading it is inside a JAR in $CATALINA_HOME/shared/lib.
>> Beside the JNI library is a native library libBar.dylib.
>>
>> I'm running Tomcat 5.0.25 on Mac OS X 10.3.4
>>
>> Here's the exception:
>>
>> UnsatisfiedLinkError:
>> /Users/henryson/Library/Java/Extensions/libFoo.jnilib:
>> java.lang.UnsatisfiedLinkError:
>> /Users/henryson/Library/Java/Extensions/libFoo.jnilib:
>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
>> at java.lang.Runtime.loadLibrary0(Runtime.java:788)
>> at java.lang.System.loadLibrary(System.java:834)
>>
>> I have tried loading the library from a small Java application
>> outside the Tomcat server and it works fine when all
>> classes/libraries are within the same folder.
>>
>> Of course I have searched for a solution on Google and I have also
>> search old entries on this list (in an archive on a website) but
>> there just don't seem to be a solution available out there... =(
>>
>> Anyone that have a clue? I would be VERY thankful =)
>>
>> Regards,
>>
>> Josef Henryson
>>
> Well given the fact that the JNI library works fine when in a stand
> alone environment, it sounds like a load path problem. I'm not sure
> what OS X uses, but on unix it is the LD_LIBRARY_PATH, or on Windows
> the PATH. Try and get the code to output the environment before it
> does the load library call and make sure that the locations for all
> the dependant libraries are there.
Tim, thank you for your advice.
I tried setting java.library.path before, but when setting
LD_LIBRARY_PATH and DYLD_LIBRARY_PATH (Mac OS X/Darwin) it seems to
work!! :-)
However, it only works when I'm running Tomcat from the startup script
from command line. When I try to start Tomcat from Eclipse plugin, it
still doesn't find the library =( Which makes it harder to debug...
Anyone familiar with setting library paths to be found from
Eclipse/Tomcat plugin??
TIA,
Josef
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: UnsatisfiedLinkError - JNI
Posted by Tim Penhey <ti...@penhey.net>.
Josef Henryson wrote:
> Hi!
>
> I get an UnsatisfiedLinkError when trying to System.loadLibrary("foo")
> from a class instantiated within a Servlet. The library libFoo.jnilib
> is in a folder within java.library.path and the class loading it is
> inside a JAR in $CATALINA_HOME/shared/lib. Beside the JNI library is a
> native library libBar.dylib.
>
> I'm running Tomcat 5.0.25 on Mac OS X 10.3.4
>
> Here's the exception:
>
> UnsatisfiedLinkError:
> /Users/henryson/Library/Java/Extensions/libFoo.jnilib:
> java.lang.UnsatisfiedLinkError:
> /Users/henryson/Library/Java/Extensions/libFoo.jnilib:
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1560)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1485)
> at java.lang.Runtime.loadLibrary0(Runtime.java:788)
> at java.lang.System.loadLibrary(System.java:834)
>
> I have tried loading the library from a small Java application outside
> the Tomcat server and it works fine when all classes/libraries are
> within the same folder.
>
> Of course I have searched for a solution on Google and I have also
> search old entries on this list (in an archive on a website) but there
> just don't seem to be a solution available out there... =(
>
> Anyone that have a clue? I would be VERY thankful =)
>
> Regards,
>
> Josef Henryson
>
Well given the fact that the JNI library works fine when in a stand
alone environment, it sounds like a load path problem. I'm not sure
what OS X uses, but on unix it is the LD_LIBRARY_PATH, or on Windows the
PATH. Try and get the code to output the environment before it does the
load library call and make sure that the locations for all the dependant
libraries are there.
Hope that helps,
Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org