aspose file tools*
The moose likes JBoss/WildFly and the fly likes UnsatisfiedLinkError on JBoss calling a JNI native method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "UnsatisfiedLinkError on JBoss calling a JNI native method" Watch "UnsatisfiedLinkError on JBoss calling a JNI native method" New topic
Author

UnsatisfiedLinkError on JBoss calling a JNI native method

aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
Hi all

I'm having problem deploying a simple JNI Web App on JBoss 4.0.5.

The required .dll files are in the path.

When my Servlet tries to invoke the native method, it gives me the UnsatisfiedLinkError.

Needles to say, it works just fine in a standalone application.

What am I doing wrong ? Please let me know the solution for this problem. I am struggling from 2days to rectity this problem.

Thanks in advance,
Aresh babu
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
in winsows you have to set the PATH variable ( in server startup script ) in unix you set shared library as LD_LIBRARY_PATH . I am not sure if you have to use jvm args -Djava.library.path . post a detail description of how are you starting the server and setting the path variable .


# Help an unprivileged kid.<br /> Whatever u do will make a difference...<br /> ...to a child's life & ur own #<br /><a href="http://www.cry.org/" target="_blank" rel="nofollow">www.cry.org/</a>
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
Hi Kripal,

In the java program itself i am setting the classpath in the follwing way

System.setProperty("java.library.path","dllfilename.dll");
System.loadLibrary("dllfilename.dll");

But i am not able to call a native method. While calling the native method it is giving the exception.

I have set the classpath in run.bat file also. Now also i am getting the same exception.

Please help me in this regard.

Thanks & Regards
Aresh Babu A
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
you need to set the path variable i run.bat if you are using windows

some thing like
path = %PATH%;newdir

or path= %PATH%;C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem

set the path variable before you set any other variable like CLASSPATH or VM args .
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
HI Kripal,

now also i am getting the same exception.
Can you please tell me why i am getting this exeception??

Thanks
Aresh Babu
sachin burange
Ranch Hand

Joined: Jun 24, 2008
Posts: 41
not able to find few of the libs in common directory.
can you please attach a stack trace.


Regards
Sachin
aresh babu
Ranch Hand

Joined: Aug 31, 2008
Posts: 65
Hi

sorry i am not able to attach the stack trace.
Can you please tell me how to rectify this error..

Thanks
Aresh Babu
sachin burange
Ranch Hand

Joined: Jun 24, 2008
Posts: 41
Not sure what happens with your case.
I have encountered this error couple of times. There may be following reasons

- In you app their may be duplicate jar files container different versions.
- check shared lib of JBOSS server.
- Try using fresh JBOSS server and fresh deployment.

Regards
sachin
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: UnsatisfiedLinkError on JBoss calling a JNI native method