Re: OSGi with Bndtools and Apache Felix throws exception
Posted by
gouessej on
Mar 26, 2013; 9:02am
URL: https://forum.jogamp.org/OSGi-with-Bndtools-and-Apache-Felix-throws-exception-tp4028765p4028823.html
sneakpaw wrote
Apparently JOGL uses a Class.forName(...) to get the class, which is not recommended practice for OSGI. Interestingly while trying to access the same class (also with Class.forName(...)) from within the bundle itself (actually from the test-bundle), I got the class just fine... and apparently the subsequent call within JOGL also succeeds then... I consider that a temporary workaround, not a fix.
There is probably a problem with the class loader. Class.forName() uses the current one, the class loader of the caller. This is not up to JOGL to be in the correct class loader, it is up to the application using it. Just use Thread.currentThread().setContextClassLoader(ClassLoader) if you need to use another class loader like I already do in Eclipse RCP and Netbeans RCP applications. What alternatives do we have? What can we do instead of calling Class.forName()?