OSGi - NoClassDefFoundError after bundle update

65 Views Asked by At

I have a bundle that is searching for other 5 bundles like this:

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

Again, after stopping Apache Felix completely, all bundles are found without any problem. But I want to update this bundle without having to completely restart the entire felix platform each time.

I have tried to use "refresh" command, but it doesnt help.

1

There are 1 best solutions below

0
Dakado On

Turned out, that those 2 bundles had a package with the same name that somehow messed up the OSGi classloader. After renaming the package, bundle update works just fine.