简体   繁体   English

OSGi - 捆绑更新后的 NoClassDefFoundError

[英]OSGi - NoClassDefFoundError after bundle update

I have a bundle that is searching for other 5 bundles like this:我有一个包正在搜索其他 5 个包,如下所示:

BundleContext.getServiceReference(MyService.class.getName());
BundleContext.getServiceReference(AnotherService.class.getName());
...

It works fine on first startup of apache felix, but once I update the bundle (from which I am trying to find the other bundles) using "update bID" command from apache felix, only 4 out of 5 other bundles are found, one always throws NoClassDefFoundError, I do not understand why, all of the bundles are added the similar way into pom.xml它在第一次启动 apache felix 时工作正常,但是一旦我使用 apache felix 中的“更新 bID”命令更新捆绑包(我试图从中找到其他捆绑包),只找到 5 个其他捆绑包中的 4 个,总是抛出 NoClassDefFoundError,我不明白为什么,所有的包都以类似的方式添加到 pom.xml

Again, after stopping Apache Felix completely, all bundles are found without any problem.同样,在完全停止 Apache Felix 后,发现所有捆绑包都没有任何问题。 But I want to update this bundle without having to completely restart the entire felix platform each time.但我想更新这个捆绑包,而不必每次都完全重新启动整个 felix 平台。

I have tried to use "refresh" command, but it doesnt help.我曾尝试使用“刷新”命令,但它没有帮助。

Turned out, that those 2 bundles had a package with the same name that somehow messed up the OSGi classloader.原来,这两个捆绑包有一个 package 同名,不知何故弄乱了 OSGi 类加载器。 After renaming the package, bundle update works just fine.重命名 package 后,捆绑更新工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM