简单实验 -
bundle A需要一些com.sun.xml.internal.bind类才能通过它的类加载器(jaxb ..)
来使用它们我搜索了强制system.bundle的理论解决方案,通过将包添加到“org.osgi.framework.system.packages.extra”(标准框架参数)来导出com.sun.xml.internal.bind在felix中实现,记录在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的bundle定义了以下import
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)
答案 0 :(得分:2)
我看到你正在使用Bndtools。好!我们有一个特殊的属性来设置.bndrun文件中的系统包:
-runsystempackages: com.sun.xml.internal.bind
我不确定为什么当你把它放在-runproperties里面时它不起作用...可能只是一个错字但我无法发现它。无论如何最好使用-runsystempackages
,因为Bndrun解析器也知道将这些包添加到系统包中;那么你也可以在bndrun编辑器中解决。