我有两个包,一个导出两个包,然后B使用这两个包(org.dom4j,org.dom4j.io),而B仍然使用其他包导出的spring包。如果我加载bundle A然后在osgi控制台中加载bundle B,则没有解析器问题。
但是,如果我将这两个包放入par,如果在synthetic.context包中失败,则说"使用违规:
A的清单:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: device-openapi
Bundle-SymbolicName: device-openapi
Bundle-Version: 1.0.0
Export-Package: com.google.gson,
com.google.gson.annotations,
com.google.gson.internal,
com.google.gson.internal.bind,
com.google.gson.reflect,
com.google.gson.stream,
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
org.apache.commons.codec.language.bm,
org.apache.commons.codec.net,
org.apache.commons.io,
org.apache.commons.io.comparator,
org.apache.commons.io.filefilter,
org.apache.commons.io.input,
org.apache.commons.io.monitor,
org.apache.commons.io.output,
org.apache.commons.lang3,
org.apache.commons.lang3.builder,
org.apache.commons.lang3.concurrent,
org.apache.commons.lang3.event,
org.apache.commons.lang3.exception,
org.apache.commons.lang3.math,
org.apache.commons.lang3.mutable,
org.apache.commons.lang3.reflect,
org.apache.commons.lang3.text,
org.apache.commons.lang3.text.translate,
org.apache.commons.lang3.time,
org.apache.commons.lang3.tuple,
org.apache.commons.logging,
org.apache.commons.logging.impl,
org.apache.http,
org.apache.http.annotation,
org.apache.http.auth,
org.apache.http.auth.params,
org.apache.http.client,
org.apache.http.client.config,
org.apache.http.client.entity,
org.apache.http.client.methods,
org.apache.http.client.params,
org.apache.http.client.protocol,
org.apache.http.client.utils,
org.apache.http.concurrent,
org.apache.http.config,
org.apache.http.conn,
org.apache.http.conn.params,
org.apache.http.conn.routing,
org.apache.http.conn.scheme,
org.apache.http.conn.socket,
org.apache.http.conn.ssl,
org.apache.http.conn.util,
org.apache.http.cookie,
org.apache.http.cookie.params,
org.apache.http.entity,
org.apache.http.entity.mime,
org.apache.http.entity.mime.content,
org.apache.http.impl,
org.apache.http.impl.auth,
org.apache.http.impl.client,
org.apache.http.impl.conn,
org.apache.http.impl.conn.tsccm,
org.apache.http.impl.cookie,
org.apache.http.impl.entity,
org.apache.http.impl.execchain,
org.apache.http.impl.io,
org.apache.http.impl.pool,
org.apache.http.io,
org.apache.http.message,
org.apache.http.params,
org.apache.http.pool,
org.apache.http.protocol,
org.apache.http.util,
org.apache.log4j,
org.apache.log4j.chainsaw,
org.apache.log4j.config,
org.apache.log4j.helpers,
org.apache.log4j.jdbc,
org.apache.log4j.jmx,
org.apache.log4j.lf5,
org.apache.log4j.lf5.util,
org.apache.log4j.lf5.viewer,
org.apache.log4j.lf5.viewer.categoryexplorer,
org.apache.log4j.lf5.viewer.configure,
org.apache.log4j.net,
org.apache.log4j.nt,
org.apache.log4j.or,
org.apache.log4j.or.jms,
org.apache.log4j.or.sax,
org.apache.log4j.pattern,
org.apache.log4j.rewrite,
org.apache.log4j.spi,
org.apache.log4j.varia,
org.apache.log4j.xml,
org.dom4j,
org.dom4j.bean,
org.dom4j.datatype,
org.dom4j.dom,
org.dom4j.dtd,
org.dom4j.io,
org.dom4j.jaxb,
org.dom4j.rule,
org.dom4j.rule.pattern,
org.dom4j.swing,
org.dom4j.tree,
org.dom4j.util,
org.dom4j.xpath,
org.dom4j.xpp,
org.json,
org.wcc.crypt,
org.wcc.framework
Import-Package: javax.crypto,javax.crypto.spec,javax.naming,javax.nami
ng.directory,javax.naming.event,javax.naming.ldap,javax.naming.spi,ja
vax.net,javax.net.ssl,javax.security.auth.x500
B&#39>显示:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NGCPlugin-service
Bundle-SymbolicName: com.myplugin.esdk.storage.service
Bundle-Version: 1.5.50
Bundle-Vendor: myplugin
Bundle-ClassPath: .
Tool: Bundlor 1.1.0.RELEASE
Export-Package: com.myplugin.esdk.storage.mvc,
com.myplugin.esdk.storage.service.datastore,
com.myplugin.esdk.storage.service.device,
com.myplugin.esdk.storage.service.host,
com.myplugin.esdk.storage.service.mount,
com.myplugin.esdk.storage.service.resource,
com.myplugin.esdk.storage.service.snapshot,
com.myplugin.esdk.storage.service.vm
Import-Package: org.apache.commons.logging,
org.dom4j,
org.dom4j.io,
org.json,org.w3c.dom,
org.xml.sax,
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
org.apache.commons.codec.language.bm,
org.apache.commons.codec.net,
org.apache.commons.io,
org.slf4j,
org.springframework.beans.factory.annotation
错误日志:
Resolver report:
Uses violation: <Import-Package: org.springframework.beans.factory.annotation; version="0.0.0"> in bundle <com.myplugin.esdk.storage.ngc-2.1.7-com.myplugin.esdk.storage.service_1.5.50[1520387337960]>
Resolver reported uses conflict for import
An Import-Package could not be resolved. Resolver error data <Import-Package: com.myplugin.esdk.storage.service.snapshot; version="0.0.0">. Caused by missing constraint in bundle <com.myplugin.esdk.storage.ngc-2.1.7-synthetic.context_2.1.7>
constraint: <Import-Package: com.myplugin.esdk.storage.service.snapshot; version="0.0.0"> constrained to bundle <com.myplugin.esdk.storage.ngc-2.1.7-com.myplugin.esdk.storage.service> constrained bundle version range "[1.5.50,1.5.50]"
with attributes {module_scope=com.myplugin.esdk.storage.ngc-2.1.7}
任何人都知道如何解决这个问题?我尝试制作一个使用Import-Bundle来导入两个bundle的所有导出包的虚拟包,在我手动取出A和B包后,这些都没有解析器错误......
答案 0 :(得分:1)
我不熟悉PAR文件的部署,使用Virgo我通常部署PLAN文件。这说,我怀疑这个问题可能是由于A导出了许多包org.apache *这些包可能已经被Virgo中包含的其他包导出,并且是Spring的依赖。因此,当您的PAR得到解决时,计划B发现自己处于从A继承相同包的情况,并且还通过传递依赖从Spring继承。
我会尝试从A清单中删除已经由处女座提供的所有包的导出。