views:

1333

answers:

2

I'm trying to create a simple plugin in eclipse. When I run the application, i saw 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?

+2  A: 

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.

VonC
I found the bug after long debugging session with breakpoints :) Somewhere in the code, I try to add an element to null array list! I focused on the bundle error and could not see it. Also, there was no exception for the array list. But, it's very interesting that, if I don't use a breakpoint, the debug session does not go into the class that contains the bug. The debug session terminates with the exception when I try create the object. So, we can say this is exactly ClassNotFoundException :)
penguru
Thanks for help..
penguru
A: 

I found the reason of the error. 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 of plugin ?

penguru
Just completed my answer in response to this comment.
VonC