来自片段与宿主冲突的约束
我正在尝试使用 Fragment-Host 扩展从包 B 导入包 A。 在捆绑 BI 中有这一行:Fragment-Host: 在捆绑包 B 的导入包中,我添加了捆绑包 A 所需的导入
当我尝试使用清单更新捆绑包 B 并启动它时,我收到错误: “来自片段的约束与主机冲突”,其中包含捆绑包 B 中存在的所有导入的列表,但是在检查捆绑包 AI 的清单时,不明白为什么这些导入如果不存在就会发生冲突
还值得一提的是,我仅在 OSGi 容器中运行两个捆绑包的一个版本,并且我已经尝试在更新后重新启动容器。
捆绑包 A 清单:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: hudson
Build-Jdk: 1.6.0_20
Export-Package: <list of packages>
Tool: Bnd-0.0.311
Bundle-Name: Logging infrastructure
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Version: 0.7.0
Bundle-ManifestVersion: 2
Bundle-Activator: <activator class>
Bundle-SymbolicName: com.mycomp.bundlea
Import-Package: com.sap.tc.logging,org.apache.commons.logging,org.apac
he.log4j,org.apache.log4j.helpers,org.apache.log4j.spi,org.apache.log
4j.xml,org.eclipse.osgi.framework.console;version="1.0",org.osgi.fram
ework;version="1.5",org.osgi.service.cm;version="1.2",org.osgi.servic
e.log;version="1.3",org.osgi.util.tracker;version="1.4"
Eclipse-RegisterBuddy: com.sap.org.apache.log4j
捆绑包 B 清单:
Manifest-Version: 1.0
Export-Package: org.perf4j;uses:="org.perf4j.chart,org.perf4j.helpers"
,org.perf4j.aop;uses:="javax.interceptor,org.apache.commons.jexl,org.
aspectj.lang,org.aspectj.lang.annotation,org.perf4j",org.perf4j.chart
;uses:="org.perf4j,org.perf4j.helpers",org.perf4j.commonslog;uses:="o
rg.apache.commons.logging,org.perf4j",org.perf4j.commonslog.aop;uses:
="org.aspectj.lang.annotation,org.perf4j,org.perf4j.aop,org.perf4j.co
mmonslog",org.perf4j.helpers;uses:="javax.management,org.perf4j",org.
perf4j.javalog;uses:="org.perf4j",org.perf4j.javalog.aop;uses:="org.a
spectj.lang.annotation,org.perf4j,org.perf4j.aop,org.perf4j.javalog",
org.perf4j.log4j;uses:="javax.management,org.apache.log4j,org.apache.
log4j.helpers,org.apache.log4j.spi,org.perf4j,org.perf4j.chart,org.pe
rf4j.helpers",org.perf4j.log4j.aop;uses:="org.aspectj.lang.annotation
,org.perf4j,org.perf4j.aop,org.perf4j.log4j",org.perf4j.log4j.servlet
;uses:="org.perf4j.chart,org.perf4j.servlet",org.perf4j.servlet;uses:
="javax.servlet,javax.servlet.http,org.perf4j.chart",org.perf4j.slf4j
;uses:="org.perf4j,org.slf4j",org.perf4j.slf4j.aop;uses:="org.aspectj
.lang.annotation,org.perf4j,org.perf4j.aop,org.perf4j.slf4j"
Implementation-Title: Perf4J
Implementation-Version: 0.9.13
Built-By: devinea
Specification-Vendor: perf4j.org
Tool: Bundlor 1.0.0.RELEASE
Created-By: Apache Maven
Implementation-Vendor: perf4j.org
Implementation-Vendor-Id: org.perf4j
Build-Jdk: 1.5.0_22
Specification-Title: Perf4J
Import-Package: javax.interceptor,javax.management,javax.servlet,javax
.servlet.http,org.apache.commons.jexl,org.apache.commons.jexl.context
,org.apache.commons.logging,org.apache.log4j,org.apache.log4j.helpers
,org.apache.log4j.spi,org.aspectj.lang,org.aspectj.lang.annotation,or
g.slf4j,org.perf4j.log4j
Specification-Version: 0.9.13
Main-Class: org.perf4j.LogParser
Archiver-Version: Plexus Archiver
Bundle-SymbolicName: org.codehaus.perf4j
Bundle-Version: 0.9.13
Fragment-Host: com.mycomp.bundlea
有什么想法...?
I am trying to extend the imports of bundle A from bundle B using Fragment-Host.
In bundle B I have this line: Fragment-Host:
and in bundle B's Import-Package I have added the imports required by bundle A
When I try to update bundle B with the manifest and start it I am getting the error:
"Constraints from the fragment conflict with the host" with a list of all the imports exist in bundle B however when examining the Manifest of bundle A I don't see why these imports should conflict if they don't exist there
Also worth mentioning that I only run one version of both bundles in the OSGi container and that I already tried restarting the container after the update.
Bundle A Manifest:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: hudson
Build-Jdk: 1.6.0_20
Export-Package: <list of packages>
Tool: Bnd-0.0.311
Bundle-Name: Logging infrastructure
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Version: 0.7.0
Bundle-ManifestVersion: 2
Bundle-Activator: <activator class>
Bundle-SymbolicName: com.mycomp.bundlea
Import-Package: com.sap.tc.logging,org.apache.commons.logging,org.apac
he.log4j,org.apache.log4j.helpers,org.apache.log4j.spi,org.apache.log
4j.xml,org.eclipse.osgi.framework.console;version="1.0",org.osgi.fram
ework;version="1.5",org.osgi.service.cm;version="1.2",org.osgi.servic
e.log;version="1.3",org.osgi.util.tracker;version="1.4"
Eclipse-RegisterBuddy: com.sap.org.apache.log4j
Bundle B Manifest:
Manifest-Version: 1.0
Export-Package: org.perf4j;uses:="org.perf4j.chart,org.perf4j.helpers"
,org.perf4j.aop;uses:="javax.interceptor,org.apache.commons.jexl,org.
aspectj.lang,org.aspectj.lang.annotation,org.perf4j",org.perf4j.chart
;uses:="org.perf4j,org.perf4j.helpers",org.perf4j.commonslog;uses:="o
rg.apache.commons.logging,org.perf4j",org.perf4j.commonslog.aop;uses:
="org.aspectj.lang.annotation,org.perf4j,org.perf4j.aop,org.perf4j.co
mmonslog",org.perf4j.helpers;uses:="javax.management,org.perf4j",org.
perf4j.javalog;uses:="org.perf4j",org.perf4j.javalog.aop;uses:="org.a
spectj.lang.annotation,org.perf4j,org.perf4j.aop,org.perf4j.javalog",
org.perf4j.log4j;uses:="javax.management,org.apache.log4j,org.apache.
log4j.helpers,org.apache.log4j.spi,org.perf4j,org.perf4j.chart,org.pe
rf4j.helpers",org.perf4j.log4j.aop;uses:="org.aspectj.lang.annotation
,org.perf4j,org.perf4j.aop,org.perf4j.log4j",org.perf4j.log4j.servlet
;uses:="org.perf4j.chart,org.perf4j.servlet",org.perf4j.servlet;uses:
="javax.servlet,javax.servlet.http,org.perf4j.chart",org.perf4j.slf4j
;uses:="org.perf4j,org.slf4j",org.perf4j.slf4j.aop;uses:="org.aspectj
.lang.annotation,org.perf4j,org.perf4j.aop,org.perf4j.slf4j"
Implementation-Title: Perf4J
Implementation-Version: 0.9.13
Built-By: devinea
Specification-Vendor: perf4j.org
Tool: Bundlor 1.0.0.RELEASE
Created-By: Apache Maven
Implementation-Vendor: perf4j.org
Implementation-Vendor-Id: org.perf4j
Build-Jdk: 1.5.0_22
Specification-Title: Perf4J
Import-Package: javax.interceptor,javax.management,javax.servlet,javax
.servlet.http,org.apache.commons.jexl,org.apache.commons.jexl.context
,org.apache.commons.logging,org.apache.log4j,org.apache.log4j.helpers
,org.apache.log4j.spi,org.aspectj.lang,org.aspectj.lang.annotation,or
g.slf4j,org.perf4j.log4j
Specification-Version: 0.9.13
Main-Class: org.perf4j.LogParser
Archiver-Version: Plexus Archiver
Bundle-SymbolicName: org.codehaus.perf4j
Bundle-Version: 0.9.13
Fragment-Host: com.mycomp.bundlea
Any ideas...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
约束冲突很难远程诊断,特别是因为 Equinox 在其错误消息中提供的信息非常少……Felix 在这方面做得更好,但看起来您通过一些 Eclipse 特定的扩展标头与 Equinox 绑定在一起。
有关问题的一些一般性指示和解释,请参阅我之前写的以下两篇博客文章:
http://njbartlett.name/2011/09/02/uses-constraints.html
http://njbartlett.name/2011/03/31/uses-constraints -in-felix.html
Constraint conflicts are difficult to diagnose remotely, especially since Equinox gives very little information in its error messages... Felix is better at this but it looks like you are tied to Equinox with some Eclipse-specific extension headers.
For some general pointers and an explanation of the problem, see the following two blog posts that I wrote some time ago:
http://njbartlett.name/2011/09/02/uses-constraints.html
http://njbartlett.name/2011/03/31/uses-constraints-in-felix.html