简单的实验——
bundle A 需要一些 com.sun.xml.internal.bind 类才能通过它的类加载器 ( jaxb.. ) 使用
我通过将包添加到“org.osgi.framework.system.packages.extra”(在 felix 中实现的标准框架参数)来搜索强制 system.bundle 导出 com.sun.xml.internal.bind 的理论解决方案,记录在http://felix.apache.org/site/apache-felix-framework-configuration-properties.html)并将其导入我的包中。
通过这样做,捆绑将不再解决..
Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=com.sun.xml.internal.bind)
( 5 是使用 jaxb 的捆绑包)为“com.sun.xml.internal.bind”设置“org.osgi.framework.bootdelegation”,而不是在依赖捆绑包中导入它,如文档所述。
我是否误解了 system.packages.extra 应该做什么?我可以不解决来自 system.bundle 的导入吗?我尝试在 Import-Package 指令底部通过 bnd 在导入中显式设置 system.bundle
com.sun.xml.internal.bind;bundle-symbolic-name="system.bundle",\
*
这导致
Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (&(osgi.wiring.package=com.sun.xml.internal.bind)(bundle-symbolic-name=system.bundle))
ps:我使用 bnd 和 -runproperties 来定义这些。我的 bndrun 文件有:
-runproperties: osgi.console.enable.builtin=true,\
com.mycompany.manager.confDir=./etc,\
org.osgi.framework.system.packages.extra=com.sun.xml.internal.bind,\
org.osgi.service.http.port=8888
需要 jaxb 的包定义了以下导入
Import-Package: com.sun.xml.internal.bind,\
*
当试图在 bndrun 编辑器中解决依赖关系时,我得到
Unable to resolve <<INITIAL>> ver=null: missing requirement (osgi.identity=com.mycompany.configuration.jaxb) [caused by: Unable to resolve com.mycompany.configuration.jaxb ver=0.0.0: missing requirement (osgi.wiring.package=com.sun.xml.internal.bind)]
org.osgi.service.resolver.ResolutionException: Unable to resolve <<INITIAL>> ver=null: missing requirement (osgi.identity=com.mycompany.configuration.jaxb) [caused by: Unable to resolve com.mycompany.configuration.jaxb ver=0.0.0: missing requirement (osgi.wiring.package=com.sun.xml.internal.bind)]
at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:285)
at org.apache.felix.resolver.Candidates.populate(Candidates.java:153)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:148)
at biz.aQute.resolve.ResolveProcess.resolveRequired(ResolveProcess.java:34)
at org.bndtools.core.resolve.ResolveOperation.run(ResolveOperation.java:61)
at org.bndtools.core.resolve.ResolveJob.run(ResolveJob.java:43)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)