Re: JOGL with OSGi
Posted by
sam on
Aug 07, 2013; 10:39am
URL: https://forum.jogamp.org/JOGL-with-OSGi-tp3773888p4029749.html
Hi,
I'm trying the same to split JOGL and GlueGen into individual plugins using
https://github.com/reficio/p2-maven-plugin. In addition I created fragments for GlueGen and JOGL for the individual platforms.
However, I have some class loading problems. The native libraries are bundled and specified in the OSGI manifest, but when I start my application I got an UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: jogamp.nativewindow.windows.GDIUtil.initIDs0()Z
I debugged the code and it was successfully able to load the "nativewindow-win32.dll" library. But it seems to be that it will loaded in the wrong classpath. To be more precise, GDIUtil uses the JNILibLoaderBase class to load the library using System.load(.../nativewindow-win32.dll).
The problem is that System.load(...) will use the classloader of the caller class (= JNILibLoaderBase) to store the reference to the loaded library. But this class is part of the gluegen bundle. Therefore after the library was successfully loaded, it will created the java.lang.UnsatisfiedLinkError error, as the library was not loaded with the correct classloader (the one of GDIUtil = jogl bundle classloader)
Has anyone an idea how to fix this? (besides bundling gluegen and jogl together)
btw: It would be great, if temp jar resolver (-natives-windows-amd64.jar thing) would be more handy and check different options, following maven (<base>-<version>-natives-windows-amd64.jar) and osgi syntaxes (<base>-natives-windows-amd64_<version>.jar)