Description
When OSGi framework is reprovisioned (e.g., during Karaf feature reinstallation), there may be a race related to CXF servlet registration/unregistration and we can see this in logs:
2017-08-02 09:04:23,554 | ERROR | lixDispatchQueue | cxf-rt-transports-http | FrameworkEvent ERROR - org.apache.cxf.cxf-rt-transports-http java.lang.IllegalArgumentException: Alias [/cxf] was never registered at org.ops4j.pax.web.service.internal.HttpServiceStarted.unregister(HttpServiceStarted.java:278) at org.ops4j.pax.web.service.internal.HttpServiceProxy.unregister(HttpServiceProxy.java:77) at org.apache.cxf.transport.http.osgi.ServletExporter.updated(ServletExporter.java:54) at org.apache.cxf.transport.http.osgi.HttpServiceTrackerCust.removedService(HttpServiceTrackerCust.java:52) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:956) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1) at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341) at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:902) at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:943) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:794) at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:544) at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4445) at org.apache.felix.framework.Felix.access$000(Felix.java:77) at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:404) at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:153) at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:128) at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:336) at org.ops4j.pax.web.service.internal.Activator$2.run(Activator.java:286) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
I think it'd be good to just print warning (or information) and continue. When http service is reregistered, servlet will be registered in proper instance of HttpService