JDK-4286309 : JNI dll re-launch with the system.loadLibrary produces "Unsatisfied link error"
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: solaris_2.6
  • CPU: x86
  • Submitted: 1999-10-29
  • Updated: 2000-02-01
  • Resolved: 2000-02-01
Description
the scenario is that we go offpage, causing the applet to end,
then return to the page, causing a relaunch.  Doing a refresh in IE or
shift/reload in Netscape does the same thing.  If we enable caching in the
plugin, we get the same thing;  an "Unsatisfied link error" exception thrown,
because the dll is already loaded.  One, I'm not real thrilled about the error
message, which seems to be multipurpose (used for real unsatisfied errors as
well).

The stack trace we receive is as follows:

java.lang.UnsatisfiedLinkError: Native Library C:\Program Files\Metaphase
Enterprise 3.2\dmm\DMComJNI.dll already loaded in another classloader
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java, Compiled Code)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1235)
at java.lang.Runtime.loadLibrary0(Runtime.java:470)
at java.lang.System.loadLibrary(System.java:768)
at
COM.metaphasetech.tasks.dmm.util._Utility._loadLibrary(_Utility.java:926)
at
COM.metaphasetech.tasks.dmm.com._WinRegJNI._NotIEGetRegKeyValue(_WinRegJNI.j
ava:88)
at
COM.metaphasetech.tasks.dmm.com._WinReg._getRegKeyValue(_WinReg.java:99)
at
COM.metaphasetech.tasks.dmm.servermap._Cache._getOSValues(_Cache.java:294)
at COM.metaphasetech.tasks.dmm.servermap._Cache.<init>(_Cache.java, Compiled
Code)
at COM.metaphasetech.tasks.dmm.servermap._Cache._setup(_Cache.java:337)
at
COM.metaphasetech.tasks.dmm.main.DocumentManager.start(DocumentManager.java,
Compiled Code)
at
COM.metaphasetech.tasks.dmm.main.DocumentManagerLauncher.launch(DocumentMana
gerLauncher.java:39)
at COM.metaphasetech.tfw.TaskLauncher.launchTask(TaskLauncher.java:700)
at
COM.metaphasetech.tfw.MTILauncherApplet.run(MTILauncherApplet.java:147)
at java.lang.Thread.run(Thread.java:479)


We load our jni dll via a static initializer:

static
   {
      System.loadLibrary("DMComJNI");
   }

Our plugin version is (from the Java console):


Java(TM) Plug-in: Version 1.2.2.px

Using JRE version 1.2.2

Comments
WORK AROUND the workaround is to turn on "cache jars in memory".
11-06-2004

EVALUATION Currently, dynamic library can only be loaded and associated with one and only one classloader in the VM. If the library is loaded again, unsatified link error will be resulted. This is why when "cache jar in memory" is disabled, it fails, because a new classloader will be created and the DLL will be loaded again, and the DLL will be associated with more than one classloader. Thus, this is not a bug; rather, this is a limitation of the current VM implementation. stanley.ho@Eng 2000-02-01
01-02-2000

SUGGESTED FIX Always enable "cache jar in memory". stanley.ho@Eng 2000-02-01
01-02-2000