ClassNotFoundException for org.osgi.framework.BundleActivator despite of Import-Package

僤鯓⒐⒋嵵緔 提交于 2021-01-27 06:32:25

问题


I tried running a really simple OSGi "Hello World"-style example with an activator after a longer while again and got a ClassNotFoundException for org.osgi.framework.BundleActivator (see stack trace below).

The environment is basic Equinox (org.eclipse.osgi_3.7.2...). All bundles (besides mine) are ACTIVE. I have "org.osgi.framework" in my "Import-Package" declaration in the manifest, and I can see the class in the package dependencies in Eclipse.

Can someone give me a hint on what to try to troubleshoot this?

Kind regards, André

Caused by: java.lang.ClassNotFoundException: org.osgi.framework.BundleActivator
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 30 more

回答1:


Sorry for answering this myself, but others might have a similar confusing issue. What happened was that there was a third party library (in this case Jersey) requiring a newer version of OSGi that I had included. Hence that library could not find (the right version of) BundleActivator.




回答2:


Make sure there is a line break after the last line of the
manifest



来源:https://stackoverflow.com/questions/32179689/classnotfoundexception-for-org-osgi-framework-bundleactivator-despite-of-import

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!