Login  Register

Re: OSGi with Bndtools and Apache Felix throws exception

Posted by sneakpaw on Mar 25, 2013; 3:52pm
URL: https://forum.jogamp.org/OSGi-with-Bndtools-and-Apache-Felix-throws-exception-tp4028765p4028797.html

I've tried to implement my own JarUtil.Resolver, following your example. Unfortunately, there is no FileLocator in Felix, so I had to work around that. After parsing the URL (e.g "bundle://3.0:1/com/jogamp/common/os/Platform.class") myself and fetching the reference for the file, I noticed that this doesn't seem to be the information that JOGL wants. (it checks, whether the result starts with "jar:", which it does not: "bundle://3.0:0/com/jogamp/common/os/Platform.class")

I rewrote the path (in a quite ugly way, but enough for testing), so that it returns "jar:bundle://3.0:0/gluegen-rt.jar!..." and "jar:bundle://3.0:0/jogl-all.jar!..." respectively. Now it finds the correct libraries within the JARs.

Unfortunately, the same ArrayIndexOutOfBoundsException as before. Here is some log output, including some of my own debug messages

16:39:50.188 [main] DEBUG org.example.Activator - Starting Bundle
16:39:50.208 [main] DEBUG org.example.Activator - unresolved: bundle://3.0:1/com/jogamp/common/os/Platform.class
16:39:50.208 [main] DEBUG org.example.Activator - resolved: jar:bundle://3.0:0/gluegen-rt.jar!/com/jogamp/common/os/Platform.class
16:39:50.298 [main] DEBUG org.example.Activator - unresolved: bundle://3.0:2/jogamp/nativewindow/NWJNILibLoader.class
16:39:50.298 [main] DEBUG org.example.Activator - resolved: jar:bundle://3.0:0/jogl-all.jar!/jogamp/nativewindow/NWJNILibLoader.class
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:550)
        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:94)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
        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)


I don't have the DLLs any where any more except in the native-JARs, so I'm quite sure it uses those now.
Maybe you have another idea, what goes wrong.