[英]OSGI bundle .bnd file and conflicting import-package statements
I inherited a .bnd file that has the import !javax. 我继承了一个具有导入!javax的.bnd文件。 , and my program produces runtime errors if I take out that statement.
,如果我删除该语句,程序将产生运行时错误。 I currently need to add JavaHelp to my application, which is under javax.help.
我目前需要将JavaHelp添加到我的应用程序中,该应用程序位于javax.help下。 .
。 When I have both of those imports in my .bnd and I use a class from JavaHelp, it produces a ClassNotFoundException for the specific class, like javax.help.JHelp.
当我在.bnd中同时拥有这两个导入并且使用JavaHelp中的类时,它将为特定类生成ClassNotFoundException,例如javax.help.JHelp。 Is there a way to handle this situation, I feel stuck.
有办法解决这种情况,我感到很困惑。
Bundles generally need to import all the package that do not start with "java.". 捆绑软件通常需要导入所有不以“ java”开头的软件包。 This includes "javax."
这包括“ javax”。 packages.
包。 If your bnd file explicitly does not import javax.
如果您的bnd文件明确不导入javax。 package, then it must rely upon non-standard boot delegation configuration for the framework.
软件包,那么它必须依赖非标准的启动委托配置框架。 That is, the boot delegation provides "free" access to javax.
也就是说,引导委托提供对javax的“免费”访问。 packages from the bundles parent classloader (likely the bootclassloader).
捆绑包的父类加载器(可能是bootclassloader)中的软件包。 So when you remove !javax.
因此,当您删除!javax时。 from the bnd file, your bundle starts to import those packages from some provider which may not be the same as whatever bootdelegation is providing.
从bnd文件中,您的捆绑包开始从某个提供程序导入那些软件包,而这些软件包可能与bootdelegation提供的内容不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.