• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Native lib is already loaded in another classloader

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic