Search code examples
javaeclipseeclipse-pluginosgiosgi-bundle

The activator for bundle is invalid


I'm trying to create a simple plugin in eclipse. When I run the application, I see this error in log file:

org.osgi.framework.BundleException : The activator for bundle org.x.y.Activator for bundle org.x.y is invalid.

Do you have any idea about this error?


Solution

  • Check your build.properties section

    If it doesn't properly specify what's supposed to be in the final binary result, it will not work. Check the .class files are where the MANIFEST.MF says they will be.


    from EclipseZone, another reason for this error message:

    If you see a message in the log like

     The activator org.example.FooActivator for bundle org.example.foo is invalid 
    

    , then this usually means there has been a ClassNotFoundException trying to load the class in the first place, before it's even got to the start() method.


    penguru adds:

    The error occurs when I try create a new object from any other class in the constructor of activator class. Isn't it legal to create an object in activator plugin ?

    • If that class if from another plugin which has not yet been "activated", that could be your problem.
    • If that class is not found, that would also invalidate your plugin activator.

    Basic advice: you may be better off with your initializations done in the start() method of Activator rather than its constructor.