Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 823
penguru Avatar asked Aug 20 '09 10:08

penguru


6 Answers

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.

like image 118
VonC Avatar answered Nov 12 '22 11:11

VonC


I also faced same issue while importing plugins from different workspace. Basically, it is the bundle classpath where the framework looks for while loading the classes. When you import to a different workspace, make sure you change the class path to point to appropriate location i.e. where the class file are present.

After modifying the classpath try to clean and re-build and re-run. It should work..hopefully..

like image 20
A Nair Avatar answered Nov 12 '22 09:11

A Nair


OK, I hate to be captain obvious here, but I've made this mistake before. This can also happen when you forget to extend BundleActivator.

like image 40
Jared Avatar answered Nov 12 '22 09:11

Jared


If you have move the eclipse workspace to a new path, then you should use the project->clean before your plugin build, Or you would meet this problem.

like image 1
Peica Avatar answered Nov 12 '22 09:11

Peica


I spent some time with this problem. Finally I noticed that the ClassNotFoundExceptions were not in line with my code, they were coming from wrong (old) packages. I checked if there was some other plugin which was messing with my debugs/exports and indeed there was, my own plugin!

So a simple fix to try if you're facing this and the CNFE's are not in line with your code:

  • Go to "Install new software"
  • Click on "already installed"
  • Remove all instances of your package/plugin and restart

Likely this was caused because I changed the plugin ID, making Eclipse treat it as a new plugin.

Another good site to take a look if you're getting frustrated and stuck: http://www.eclipsezone.com/eclipse/forums/t99010.html

like image 1
Guu Avatar answered Nov 12 '22 10:11

Guu


In my case there was this Message "Activator ..invalid" but in the next exceptions there were ClassNotFound Exceptions in a Bundle were i didnt change something..

Guu(Posted a solution too) is my hero, After increasing

Bundle-ManifestVersion: 2

to

Bundle-ManifestVersion: 3

everything works :)

like image 1
Matthias H Avatar answered Nov 12 '22 09:11

Matthias H