Sonntag, 2. September 2012

OSGi Error: NoClassDefFoundError

If we look at this example
java.lang.NoClassDefFoundError: Could not initialize class com.example.MyClass

This error means that the class "MyClass" was found, but the classloader couldn't finish loading it. The Reason could be that MyClass depends on a other class which is missing.

This can happen when the bundle was compiled when the depending classes where present but they won't be in the bundle or any other exporting bundle.

To debug such an error you need to trace back through the dependencies. The problem is that the real missing dependency may be at the bottom of the dep.-stack.

By the Way: The "ClassNotFoundException" means that the given class (e.g.: MyClass) was not found.

Keine Kommentare:

Kommentar veröffentlichen