简体   繁体   English

osgi start bundle NoClassDefFoundError

[英]osgi start bundle NoClassDefFoundError

I am working through Neil Bartlett's series at EclipseZone on getting started with OSGi. 我正在EclipseZone的Neil Bartlett系列中开始使用OSGi。 I'm on the 3rd lesson at http://www.eclipsezone.com/eclipse/forums/t90796.html . 我在http://www.eclipsezone.com/eclipse/forums/t90796.html的第3课。

After creating and installing the jar file, I get a problem starting it: 创建并安装jar文件后,我遇到了问题:

org.osgi.framework.BundleException: The activator osgitut.movies.impl.MovieListerActivator for bundle MoviesLister is invalid
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:171)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:291)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:333)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:209)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:155)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:140)
        at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:104)
        at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: osgitut/movies/MovieLister
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413)
        at java.lang.Class.getConstructor0(Class.java:2723)
        at java.lang.Class.newInstance0(Class.java:345)
        at java.lang.Class.newInstance(Class.java:327)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:166)

Here is the manifest: 这是清单:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Movies Lister
Bundle-SymbolicName: MoviesLister
Bundle-Version: 1.0.0
Bundle-Activator: osgitut.movies.impl.MovieListerActivator
Import-Package: org.osgi.framework,org.osgi.util.tracker,osgitut.movies
Export-Package: osgitut.movies;version="1.0.0",osgitut.movies.impl;version="1.0.0"

Looks the osgitut/movies/MovieLister class is missing but it is in the jar file I create. 看起来缺少osgitut / movies / MovieLister类,但它在我创建的jar文件中。 I suspect I'm missing something in the Manifest but I can't figure out what. 我怀疑我在Manifest中遗漏了一些东西,但我无法弄清楚是什么。

你有一个NoClassDefFoundError ,它表明MovieListener类本身并不完整,并且依赖于超类或者有一个成员,在该bundle中无法解析该类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM