8 Replies Latest reply on Apr 8, 2002 3:10 AM by Jason Dillon

    JNI Libraries, Classloaders and redeployment

    Erik Mattsson Newbie

      We're developing a Servlet that uses a JNI library and have managed to deploy this through our web-host server. The server is using JBoss and re-detects and reloads new servlet .wars when necessary. This have functioned very good until today, when we finnaly got our JNI code working through the autoconfiguring that JBoss do. (earlier post in this forum)

      Now we discovered that when our servlet is re-deployed it tries to re-load the JNI library, so we can use it in the servlet. But using the System.loadLibrary() throws a Throwable that states :

      java.lang.UnsatisfiedLinkError: Native library /dunder1/home/userC/c0017200/public_html/royal11.levonline.com/deploy/bin/libJpeg2000ServletDecoder.so already loaded in another classloader
      at java.lang.ClassLoader.loadLibrary0 ClassLoader.java:1346)
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1306)
      at java.lang.Runtime.loadLibrary0(Runtime.java:749)
      at java.lang.System.loadLibrary(System.java:820)
      at com.imbridge.iwip.servlet.IwipServlet.doGet(IwipServlet.java:136)

      Code :
      } catch ( UnsatisfiedLinkError e )

      And it seems that we must load the library again for the servlet since we trying to access the JNI method it throws this message:

      java.lang.UnsatisfiedLinkError: decodeJP2Impl
      at com.imbridge.iwip.servlet.codec.Jpeg2000ServletDecoder.decodeJP2Impl(Native Method)
      at com.imbridge.iwip.servlet.codec.Jpeg2000ServletDecoder.decodeJP2(Jpeg2000ServletDecoder.java:31)
      at com.imbridge.iwip.servlet.ImageFileArchiver.saveImage(ImageFileArchiver.java:294)
      at com.imbridge.iwip.servlet.ImageFileArchiver.archive(ImageFileArchiver.java:175)

      Do anyone have ANY clue on how we can unload the library when closing the servlet, and then re-load it the next time ???

      Any help is appreciated