The activator for bundle is invalid

2020-02-25 07:01发布

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?

14条回答
相关推荐>>
2楼-- · 2020-02-25 07:25

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.

查看更多
太酷不给撩
3楼-- · 2020-02-25 07:27

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.

查看更多
Evening l夕情丶
4楼-- · 2020-02-25 07:28

I also met the same error. The activator XX for bundle XX is invalid, and the ClassNotFoundException. I checked plugins\ directory, and could not find the class needed.

-- Because there is no jar file containing the needed class, there is only the corresponding directory. For example, there is no com.hh.jar, but only com.hh directory.

So, there must be something wrong about creating the com.hh.jar.

if com.hh.jar reference other plugins, then also check them.

I solved the problem by editing MANIFEST.MF. Open it by Plug-in Manifest Editor, in runtime tab, add needed packages in "Exported Packages". and in the "classpath", add needed libraries, and, "." (current directory, IMPORTANT)

查看更多
成全新的幸福
5楼-- · 2020-02-25 07:28

I have also run into this isue when 'bundle-izing' plain jar files. If some dependencies are not resolved, or jars depend on a higher JAVA version than the one you're using, the activator will not start, giving the above exception. The quick way to find out if this is the problem is to remove the jars from the bundle-classpath (runtime tab of the manifest) and check if the activator will run correctly.

查看更多
We Are One
6楼-- · 2020-02-25 07:30

In my case this exception was because of inability of Eclipse custom class loader to resolve and load all depending classes from other plugins in-time. I am not Eclipse super-guru so maybe it was my fault.

However it was fixed by disabling lazy loading of plugin. In GUI on Overview tab of MANIFEST.MF editor uncheck Activate this plug-in when one of its classes is loaded. Or directly in MANIFEST.MF delete line

Bundle-ActivationPolicy: lazy
查看更多
祖国的老花朵
7楼-- · 2020-02-25 07:30

Another captain obvious: If you change the paths of your source files (e.g. src/ to src/main/java), but forget to update build.properties, the compilation will always succeed, but your plugin will never work.

查看更多
登录 后发表回答