0

我正在尝试迈出让自己熟悉 OSGI 框架的第一步。但是,我什至无法启动仅导出一个包的捆绑包,仅此而已。框架显示的错误对我来说听起来很荒谬,因为我将其读为“为了启动您的捆绑包,我需要解析 openjsip.service.locationservice 包。但是这个包来自我的包!无论如何,我认为我错了,但我无法理解问题所在,有人可以帮助我吗?

ERROR: Bundle openjsip.locationservice [6] Error starting file:////tmp/locationservice-1.0.0-SNAPSHOT.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle openjsip.locationservice [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (&(osgi.wiring.package=openjsip.service.locationservice)(version>=1.0.0)))
org.osgi.framework.BundleException: Unresolved constraint in bundle openjsip.locationservice [6]: Unable to resolve 6.0: missing requirement [6.0] osgi.wiring.package; (&(osgi.wiring.package=openjsip.service.locationservice)(version>=1.0.0))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
at java.lang.Thread.run(Thread.java:722)

这是我的清单.MF:

Manifest-Version: 1.0
Bnd-LastModified: 1348338100498
Build-Jdk: 1.7.0_05
Built-By: devel
Bundle-ManifestVersion: 2
Bundle-Name: locationservice
Bundle-SymbolicName: openjsip.locationservice
Bundle-Version: 1.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: openjsip.service.locationservice;uses:="javax.sip.header
 ,javax.sip";version="1.0.0.SNAPSHOT"
Import-Package: javax.sip;version="[1.2,2)",javax.sip.header;version="[1
 .2,2)"
Tool: Bnd-1.50.0
4

2 回答 2

1

错误消息似乎与您发布的 MANIFEST.MF 不匹配。你有可能在两者之间重建它吗?

错误消息说您的包导入了 package openjsip.service.locationservice,并且该导入无法解析。但是根据清单,您只导入javax.sipjavax.sip.header. 因此,此错误消息不可能来自发布的捆绑清单。

于 2012-09-22T19:24:09.890 回答
0

感谢大家的帮助,问题实际上出在 IDEA 配置上,它使用 facet 配置自行创建 MANIFEST.MF(我依靠 apache maven 插件将其留空)。由于某种原因,它忽略了这个插件或者还不能与它配对使用。解决方案是告诉它“使用来自 target/classes/META-INF 的预定义 MANIFEST.MF”。

再次感谢。

于 2012-09-23T05:39:56.163 回答