问题
I am working through Neil Bartlett's series at EclipseZone on getting started with OSGi. I'm on the 3rd lesson at http://www.eclipsezone.com/eclipse/forums/t90796.html.
After creating and installing the jar file, I get a problem starting it:
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. I suspect I'm missing something in the Manifest but I can't figure out what.
回答1:
You got a NoClassDefFoundError
which indicates that the MovieListener
class is not complete by itself and depends on a super class or has a member for which the class could not be resolved within the bundle.
来源:https://stackoverflow.com/questions/23478920/osgi-start-bundle-noclassdeffounderror