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?
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 ?
Basic advice: you may be better off with your initializations done in the start()
method of Activator
rather than its constructor.
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..
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.
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.
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:
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
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With