Open ops4j-issues opened 8 years ago
Cherian Mathew commented
I am also getting the same exception with using the Apache Felix Http Bridge along with the provided ProxyServlet class responsible for routing servlet urls to the loaded OSGi bundles.
The error happens during shutdown where the application server (in my case Jetty) calls the destroy method on ProxyServlet which in turn finally calls the bundleContext.getService in ServiceEventBridge to retrieve the Http Service.
But by this time the servlet context has been destroyed implying that the service returned in the above call is null since the service can no longer be created. This leads to the NullPointerException.
Stack trace follows,
java.lang.NullPointerException
at org.ops4j.pax.cdi.extension.impl.ServiceEventBridge.serviceChanged(ServiceEventBridge.java:50)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)
at org.apache.felix.framework.Felix.access$000(Felix.java:106)
at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:420)
at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:170)
at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:144)
at org.apache.felix.http.base.internal.service.HttpServiceFactory.stop(HttpServiceFactory.java:121)
at org.apache.felix.http.base.internal.HttpServiceController.unregister(HttpServiceController.java:129)
at org.apache.felix.http.base.internal.DispatcherServlet.destroy(DispatcherServlet.java:53)
at org.apache.felix.http.proxy.DispatcherTracker.destroyDispatcher(DispatcherTracker.java:91)
at org.apache.felix.http.proxy.DispatcherTracker.setDispatcher(DispatcherTracker.java:80)
at org.apache.felix.http.proxy.DispatcherTracker.removedService(DispatcherTracker.java:67)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:967)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
at org.osgi.util.tracker.ServiceTracker.close(ServiceTracker.java:377)
at org.apache.felix.http.proxy.ProxyServlet.destroy(ProxyServlet.java:69)
at org.eclipse.jetty.servlet.ServletHolder.destroyInstance(ServletHolder.java:442)
at org.eclipse.jetty.servlet.ServletHolder.doStop(ServletHolder.java:414)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.servlet.ServletHandler.doStop(ServletHandler.java:230)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.security.SecurityHandler.doStop(SecurityHandler.java:411)
at org.eclipse.jetty.security.ConstraintSecurityHandler.doStop(ConstraintSecurityHandler.java:457)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.server.session.SessionHandler.doStop(SessionHandler.java:127)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:833)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:215)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:521)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:388)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.server.Server.doStop(Server.java:456)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.stopLifeCycles(ShutdownMonitor.java:273)
at org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.run(ShutdownMonitor.java:172)
at java.lang.Thread.run(Thread.java:745)
[WARNING] Stopping OSGi framework ...
[WARNING] OSGi framework stopped
Cherian Mathew commented
Please ignore my earlier comment. Turns out that the felix container was started twice and this was the cause of the error
Charles Moulliard created PAXCDI-207
Affects: 0.11.0 Votes: 1, Watches: 2