Skip to Main Content

dll on Tomcat 6 got UnsatisfiedLinkError ... Can't find dependent libraries

843829Jan 14 2010 — edited Apr 13 2011
I created a dll file and it ran with no errors on the command line. But when i deployed it together with the java class file over to Tomcat 6.0\lib and ran it with a web application, Tomcat's log file reported:

Exception in thread "Thread-12" java.lang.UnsatisfiedLinkError: C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\Binless.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at jni.server.Binless.<clinit>(Unknown Source)
at org.brainml.analysisserver.queue.ProcessItemThread.run(ProcessItemThread.java:57)


Here is what I did:

Step 1: Compile and manifest

"%MSVCDir%\bin\cl.exe" /I"%JAVA_HOME%\include" /I"%JAVA_HOME%\include\win32" /MD /LD /FeBinless.dll ../info/binless/jni_binless.c ../jni_shared/jni_gen_c.c ../jni_entropy/jni_entropy_c.c ../../entropy/entropy_nsb_c.cpp /link libxml2.lib libgsl.a libgslcblas.a >> binless-out.txt

mt.exe -manifest Binless.dll.manifest -outputresource:Binless.dll;2

The operating system is Windows XP and has the following environment variables:

PATH=%JAVA_HOME%\bin;%LIBXMLDir%\bin;%ICONVDir%\bin;%GNUWINDir%\bin;%WINSDKDir%\bin;%MSVCDir%\bin;%MSVCDir%\..\Common7\IDE;%ZLIBDir%\bin;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem

INCLUDE=%WINSDKDir%\include;%GNUWINDir%\include;%MSVCDir%\include;%MSVCDir%\PlatformSDK\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32;%LIBXMLDir%\include;%ICONVDir%\include;%ZLIBDir%\include

LIB=%WINSDKDir%\lib;%GNUWINDir%\lib;%MSVCDir%\lib;%MSVCDir%\PlatformSDK\lib;%LIBXMLDir%\lib;%ICONVDir%\lib;%ZLIBDir%\lib

where:

GNUWINDir=c:\project\lib\GnuWin32
ZLIBDir=c:\project\lib\zlib
ICONVDir=c:\project\lib\iconv
LIBXMLDir=c:\project\lib\libxml2
WINSDKDir=C:\Program Files\Microsoft SDKs\Windows\v6.0A
MSVCDir=C:\Program Files\Microsoft Visual Studio 9.0\VC

Step 2: Compile the Java jni code

javac -d ..\classes ..\server\Binless.java

Step 3: Ran the code

java -classpath ..\classes jni.test.test_binless

Successful with no errors.

Step 4: Copied Binless.dll and Binless.class in a jar file (Binless.dll NOT in the jar file) to Tomcat 6.0\lib, and then ran a web application that called the Binless class.

Got UnsatisfiedLinkError (see above) in Tomcat's log file.

Am I missing something? Any help is greatly appreciated. Thank you.
Comments
Post Details
Added on Jan 14 2010
5 comments
1,022 views