Problem with OSGi Bundle: sun.nio.ch.DirectBuffer
Posted by Justin on May 30, 2011; 8:30am
URL: https://forum.jogamp.org/Problem-with-OSGi-Bundle-sun-nio-ch-DirectBuffer-tp3001199.html
I'm trying to wrap the JOGL libraries into an OSGi bundle using Eclipse. I can get the plugin to work from within Eclipse using its Equinox container, but problems arise when I export the plugin and try to use it from Apache Felix, for example.
The error I get when running my bundle outside Eclipse:
java.lang.NoClassDefFoundError: sun/nio/ch/DirectBuffer
at com.jogamp.common.jvm.JVMUtil.initialize(Native Method)
at com.jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:59)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:1141)
I believe this has to do with Eclipse loading certain packages (including javax.swing among others) that a pure OSGi bundle won't be aware of when deployed. I tried to manually add this package to the imported packages in my JOGL bundle manifest (works for javax.swing, which is needed by GLJPanel for instance), but Eclipse won't allow it with the sun.nio.ch package.
This is using JOGL2-rc2 (jogl-2.0-b23-20110303). I am using Mac OS X 10.6.
Thanks