Search code examples
javaosgiclassloadernoclassdeffounderror

Can't instantiate class from installed extension when run via OSGI


So, I have an installed extension (see http://docs.oracle.com/javase/tutorial/ext/basics/index.html) which I can see in Eclipse.

I've written a simple rcp application that tries to create an instance of a class in this extension. However, although everything compiles ok, I'm getting a NoClassDefFoundError when creating the instance.

I'm assuming this has something to do with OSGi because I can run a simple java application that creates the instance fine.

Any suggestions would be really appreciated.

Thanks


Solution

  • I've found another solution which is to set the parent classloader to the 'ext' classloader using the arg

    osgi.parentClassloader=ext
    

    Not sure yet the implications of such a change other than I now don't get the error.