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?
This can also happen if you name a bundle after a package in another bundle.
So:
Bundle A
which contains packageorg.my.package.name.function
,bundle B
with nameorg.my.package.name.function
,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
I had the same error, in my case I created my own constructor with parameters. But I didn't provide a default constructor. So after removing my constructor and initialized all within the start() method, it worked like charme.
I got the same exception. The underlying problem was a ClassCastException. My bundle requires org.osgi.core 4.3 whereas the equinox launcher uses 4.2.
Regards Roland
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 ?
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..