I start the JVM from my own code and then run Jetty. Webapp then downloads the JPeripheral library. Both the native launcher and JPeripheral depend on their own Jace library. When the webapp attempt tries to load jace java throws:
java.lang.UnsatisfiedLinkError: Native Library jace.dll already loaded in another classloader
Here is the ClassLoader hierarchy inside webapp:
WebAppClassLoader → sun.misc.Launcher $ AppClassLoader → sun.misc.Launcher $ ExtClassLoader
Jace.dll and Jetty are loaded using sun.misc.Launcher$AppClassLoader
(used by the built-in launcher). JPeripheral is loaded by WebAppClassLoader.
One way to solve this problem is to download JPeripheral from sun.misc.Launcher$AppClassLoader
(therefore jace.dll is loaded twice from the same Classloader twice). How to do it?
source share