in quartz-sample-nested-jars示例:
https://github.com/paulvi/osgi-run/tree/master/osgi-run-test/quartz-sample-nested-jars
出现错误,因此结果包在felix中不是ACTIVE,并且无法启动。
为什么捆绑包需要osgi.wiring.package = commonj.work?这来自哪里?如果它是你的项目的Gradle依赖项,osgi-run会把它添加到运行时...也许你只需要添加一个osgiRuntime' org:commonj.work:version' Gradle deps的声明?
完整日志
# parseClassFile(): path=org/xml/sax/ErrorHandler.class resource=:file:/C:/Program%20Files/Java/jdk1.8.0_74/jre/lib/rt.j
ar!/org/xml/sax/ErrorHandler.class:
:quartz-sample-nested-jars:createOsgiRuntime
> Building 83% > :quartz-sample-nested-jars:runOsgi
:quartz-sample-nested-jars:runOsgi
org.osgi.framework.BundleException: Unable to resolve com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0): mis
sing requirement [com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0)] osgi.wiring.package; (osgi.wiring.packa
ge=commonj.work) Unresolved requirements: [[com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0)] osgi.wiring.p
ackage; (osgi.wiring.package=commonj.work)]
ERROR: Bundle com.athaydes.gradle.osgi.quartz-sample-nested-jars [6] Error starting file:/D:/Workspaces/GitHub/osgi-run/
osgi-run-test/quartz-sample-nested-jars/build/osgi/bundle/quartz-sample-nested-jars-1.0.jar (org.osgi.framework.BundleEx
ception: Unable to resolve com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0): missing requirement [com.athay
des.gradle.osgi.quartz-sample-nested-jars [6](R 6.0)] osgi.wiring.package; (osgi.wiring.package=commonj.work) Unresolved
requirements: [[com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0)] osgi.wiring.package; (osgi.wiring.packag
e=commonj.work)])
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.lang.Thread.run(Thread.java:745)
____________________________
Welcome to Apache Felix Gogo
> Building 83% > :quartz-sample-nested-jars:runOsgilb
g! g! g! START LEVEL 1
ID|State |Level|Name
0|Active | 0|System Bundle (5.4.0)|5.4.0
1|Active | 1|c3p0 (0.9.1.1)|0.9.1.1
2|Active | 1|Apache Felix Gogo Command (0.16.0)|0.16.0
3|Active | 1|Apache Felix Gogo Runtime (0.16.2)|0.16.2
4|Active | 1|Apache Felix Gogo Shell (0.12.0)|0.12.0
5|Active | 1|quartz (2.2.1)|2.2.1
6|Installed | 1|com.athaydes.gradle.osgi.quartz-sample-nested-jars (1.0.0)|1.0.0
7|Active | 1|slf4j-api (1.6.6)|1.6.6
8|Resolved | 1|slf4j-simple (1.6.6)|1.6.6
> Building 83% > :quartz-sample-nested-jars:runOsgistart 6
org.osgi.framework.BundleException: Unable to resolve com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0): mis
sing requirement [com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0)] osgi.wiring.package; (osgi.wiring.packa
ge=commonj.work) Unresolved requirements: [[com.athaydes.gradle.osgi.quartz-sample-nested-jars [6](R 6.0)] osgi.wiring.p
ackage; (osgi.wiring.package=commonj.work)]
> Building 83% > :quartz-sample-nested-jars:runOsgi
打开问题https://github.com/renatoathaydes/osgi-run/issues/36(并非真正属于那里)
答案 0 :(得分:1)
问题似乎出现在石英套件的清单中,其中包含Export-Package
指令中的内容:
org.quartz.commonj;
uses:="commonj.work,javax.naming,org.quartz.spi,org.slf4j";
version="2.2.1"
后来,在Import-Package
指令中,这个:
commonj.work;resolution:=optional
因此,要将此捆绑包导出org.quartz.commonj
,需要导入commonj.work
,但这是可选导入...
我不确定OSGi规范在这种情况下应该发生什么,我试图在规范中找到但我找不到任何特定于这种情况...我的解释是捆绑应该仍然导出org.quartz.commonj
包,因为规范只说optional
要求不能阻止捆绑的布线满足,它没有说任何关于依赖于可选导入的导出包,据我所知
现在的问题是,为什么这适用于osgi
插件,它只是调用Bnd
来创建清单,而不是org.dm.bundle
,它也调用Bnd
,但要创造整个罐子......
在Felix中运行时,我可以看到石英套件成功导出org.quartz.commonj
包,并且可以连接到其他捆绑包,所以我认为这应该可以使用。
我建议使用org.dm.bundle
或直接使用Bnd填充错误。我相信他们能够提供更加可靠的答案,如果他们认为合适,可以修复可能导致此问题的任何错误。
答案 1 :(得分:0)
不是OSGI导出,我不能肯定地说,但我怀疑“commonj.work”包不应该在这里https://github.com/quartz-scheduler/quartz/blob/master/quartz/pom.xml#L232