osgi 启动包 NoClassDefFoundError [英] osgi start bundle NoClassDefFoundError

查看:101
本文介绍了osgi 启动包 NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 EclipseZone 完成 Neil Bartlett 的系列文章,了解 OSGi 入门.我在 http://www.eclipsezone.com/eclipse/forums 上第三节课/t90796.html.

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.

创建并安装 jar 文件后,我在启动时遇到问题:

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)

这是清单:

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"

看起来 osgitut/movies/MovieLister 类丢失了,但它在我创建的 jar 文件中.我怀疑我在 Manifest 中遗漏了一些东西,但我不知道是什么.

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.

推荐答案

你有一个 NoClassDefFoundError 这表明 MovieListener 类本身不完整,依赖于一个超类或具有无法在包中解析类的成员.

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.

这篇关于osgi 启动包 NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆