osgi插件运行不起来(bundle run fail)的问题

来源:互联网 发布:男友生日礼物 知乎 编辑:程序博客网 时间:2024/05/21 10:41

问题描述:

在做项目的时候,有一个插件在网关上可以安装成功,但是bundle run 的时候,总是fail,bundle show状态为installed,打开debug看了一下,当执行bundle run 的时候,就会抛出如下log:

[11-01-14:01:34]run cn.net.speed fail!

11-01-14:01:34]# org.osgi.framework.BundleException: Unable to resolve cn.net.speed [12](R 12.0): missing requirement [cn.net.speed [12](R 12.0)] osgi.wiring.package; (&(osgi.wiring.package=com.china.smartgateway.commservices)(version>=1.0.0)(!(version>=2.0.0))) Unresolved requirements: [[cn.net.speed [12](R 12.0)] osgi.wiring.package; (&(osgi.wiring.package=com.china.smartgateway.commservices)(version>=1.0.0)(!(version>=2.0.0)))]
[11-01-14:01:34]        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4090)
[11-01-14:01:34]        at org.apache.felix.framework.Felix.startBundle(Felix.java:2111)
[11-01-14:01:34]        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:989)
[11-01-14:01:34]        at com.chinamobile.smartgateway.mangement.Run.work(Run.java:66)
[11-01-14:01:34]        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[11-01-14:01:35]        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[11-01-14:01:35]        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11-01-14:01:35]        at java.lang.reflect.Method.invoke(Method.java:483)
[11-01-14:01:35]        at com.chinamobile.smartgateway.mangement.Service.run(Service.java:299)
[11-01-14:01:35]        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[11-01-14:01:35]        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[11-01-14:01:35]        at java.lang.Thread.run(Thread.java:744)

问题原因:

出现这种情况的原因是,cn.net.speed这个插件运行时需要依赖com.china.smartgateway.commservices这个package,而且这个package的版本要大于等于1.0.0并且小于2.0.0

解决方法:

有两种解决方式,如下:

1:修改cn.net.speed插件的MANIFEST.MF,使之对com.china.smartgateway.commservices的版本号不做限制


2:修改com.china.smartgateway.commservices的版本号,使之在1.0.0到2.0.0之间


原创粉丝点击