I launch a JVM from native code, then launch Jetty. A webapp then loads a library called JPeripheral. Both the native launcher and JPeripheral depend a native library called Jace. When the webapp tries loading Jace Java throws:
java.lang.UnsatisfiedLinkError: Native Library jace.dll already loaded in another classloader
Here is the ClassLoader hierarchy inside the webapp:
WebAppClassLoader -> sun.misc.Launcher$AppClassLoader -> sun.misc.Launcher$ExtClassLoader
Jace.dll and Jetty are both loaded by sun.misc.Launcher$AppClassLoader
(used by the native launcher).
JPeripheral is loaded by WebAppClassLoader.
One way to solve this problem would be to load JPeripheral from sun.misc.Launcher$AppClassLoader
(so jace.dll gets loaded twice from the same Classloader). How do I do that?