osgi-pluginmanager: Jersey REST services not loading reliably in Karaf 4
Description
On Bamboo and on my local machine, the Jersey REST services inside osgi-pluginmanager sometimes (>50%) fail to load, especially on startup into a clean Karaf container where the Jersey JARs have never been installed.
This is caused by a race condition between the jersey-server JAR being "Started" by the Karaf container and then the featuremanager, licencemanager, and pluginmanager REST services being started by the blueprint extender. If the REST services inside the blueprint.xmls attempt to start first, then they throw exceptions and fail to register in our OSGi HTTP bridge service, leading to 404s when trying to access them.
It looks like the best solution is to reduce the start-level of the Jersey bundles so that Karaf will start them up before the REST service bundles. This seems to fix the problem. I was running the following sequence of commands with a 100% failure rate and after the start-level change, everything is working:
Seth Leger May 11, 2017 at 11:54 AM
This stack trace is an indication of the problem but even if this shows up, I think the services can sometimes register:
On Bamboo and on my local machine, the Jersey REST services inside osgi-pluginmanager sometimes (>50%) fail to load, especially on startup into a clean Karaf container where the Jersey JARs have never been installed.
This is caused by a race condition between the jersey-server JAR being "Started" by the Karaf container and then the featuremanager, licencemanager, and pluginmanager REST services being started by the blueprint extender. If the REST services inside the blueprint.xmls attempt to start first, then they throw exceptions and fail to register in our OSGi HTTP bridge service, leading to 404s when trying to access them.