aspose file tools*
The moose likes Websphere and the fly likes Native lib is already loaded in another classloader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Native lib is already loaded in another classloader" Watch "Native lib is already loaded in another classloader" New topic
Author

Native lib is already loaded in another classloader

Chris Wang
Ranch Hand

Joined: Jan 13, 2004
Posts: 34
I have a web application deployed in WAS Server 6.1 which sitting on AIX. The web application is using a native (c++) library. I setup the native library as a shared libary. Every time when I reinstalled the application or restarted the application, I got the following exception:
java.lang.UnsatisfiedLinkError: arjni70 (Library is already loaded in another ClassLoader)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:953)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:922)
at java.lang.System.loadLibrary(System.java:451)
at com.remedy.arsys.api.Proxy.<clinit>(Proxy.java:51)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
at com.remedy.arsys.api.DefaultProxyManager.getProxy(DefaultProxyManager.java:60)
at com.remedy.arsys.api.Util.ARSetServerPort(Util.java:1461)
at com.ibm.msp.sym_smartcall.Focus.FocusAPI.focusTx(FocusAPI.java:118)
at com.ibm.msp.sym_smartcall.command.FocusTask.run(CMDReceiver_Submit.java:495)

To avoid the exception I have to restart the WAS server. Could anyone please explain why?

Thanks in advance!

Chris
dixan martinez
Greenhorn

Joined: Sep 22, 2003
Posts: 2
By "reinstall" you mean "update" using WAS console or wsadmin script, right?

Java specifications state a native library can't be loaded by two different classloaders in the same process.

In this case the class which makes JNI is being reloaded by a different classloader everytime you update or restart it, so the problem occurs.

One solution is to create a shared library with the JNI class, and the create a classloader for your app server and associate that shared library to it. This way, restarting your app won't make any change to the class loader in charge of your JNI class
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Native lib is already loaded in another classloader
 
Similar Threads
Portal integration
conflicting jar files and .dll
Oracle-JDBC dll file
[SOLVED] Oracle OCI library already loaded in another classloader exception
UnsatisfiedLinkError in Tomcat 4