Login  Register

OSGi with Bndtools and Apache Felix throws exception

Posted by sneakpaw on Mar 22, 2013; 9:01pm
URL: https://forum.jogamp.org/OSGi-with-Bndtools-and-Apache-Felix-throws-exception-tp4028765.html

Hello,

I am trying to use JOGL within an OSGI application, that is using bndtools and Apache Felix.
The application seems to find all the native libraries from "jogl-all-natives-windows-i586.jar" (when using a 32-bit VM), but it crashes when trying to display the GLCanvas.
To isolate the issue, I set up the example from the tutorial: http://jogamp.org/wiki/index.php/Using_JOGL_in_AWT_SWT_and_Swing#JOGL_in_AWT

Without OSGI, the example runs alright, but as soon as I make an OSGI bundle from it, I get the following exception when trying to run it: (in this stacktrace, I tried using an Eclipse OSGI-Runtime Environment, but it didn't help.)

java.lang.ArrayIndexOutOfBoundsException: -1
        at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:169)
        at javax.media.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:420)
        at javax.media.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1181)
        at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:571)
        at java.awt.Container.addNotify(Container.java:2769)
        at java.awt.Window.addNotify(Window.java:770)
        at java.awt.Frame.addNotify(Frame.java:487)
        at java.awt.Window.show(Window.java:1031)
        at java.awt.Component.show(Component.java:1651)
        at java.awt.Component.setVisible(Component.java:1603)
        at java.awt.Window.setVisible(Window.java:1014)
        at org.example.OneTriangularAWT.main(OneTriangularAWT.java:52)
        at org.example.Activator.start(Activator.java:14)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
        at aQute.launcher.Launcher.update(Launcher.java:307)
        at aQute.launcher.Launcher.activate(Launcher.java:235)
        at aQute.launcher.Launcher.run(Launcher.java:139)
        at aQute.launcher.Launcher.main(Launcher.java:74)


For testing and to reduce possible causes, I've set this up as a single bundle, including the JOGL libraries and native libraries.

I hope someone can help me out, and I thank you in advance