[ 
https://issues.apache.org/jira/browse/FELIX-5897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler closed FELIX-5897.
-----------------------------------

> org.apache.felix.http.proxy.ProxyServlet NullPointerException
> -------------------------------------------------------------
>
>                 Key: FELIX-5897
>                 URL: https://issues.apache.org/jira/browse/FELIX-5897
>             Project: Felix
>          Issue Type: Bug
>          Components: HTTP Service
>    Affects Versions: http.proxy-3.0.2
>            Reporter: David Nebinger
>            Assignee: Carsten Ziegeler
>            Priority: Major
>             Fix For: http.proxy-3.0.4
>
>         Attachments: FELIX-5897.patch
>
>
> I have equinox embedded in a war, using http.proxy 3.0.2 to proxy traffic 
> from WAR context into OSGi container.
> When deploying an updated WAR, all servlets including ProxyServlet will have 
> the destroy() method invoked.
> An NPE will be generated by ProxyServlet if the servlet has not serviced any 
> requests:
>  
> {code:java}
> 03-Aug-2018 20:01:35.386 SEVERE 
> [ContainerBackgroundProcessor[StandardEngine[Catalina]]] 
> org.apache.catalina.core.ApplicationContext.log Servlet [proxy] threw 
> unload() exception
>  javax.servlet.ServletException: Servlet.destroy() for servlet [proxy] threw 
> exception
>  at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1312)
>  at 
> org.apache.catalina.core.StandardWrapper.stopInternal(StandardWrapper.java:1635)
>  at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
>  at 
> org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
>  at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
>  at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:845)
>  at org.apache.catalina.startup.HostConfig.undeploy(HostConfig.java:1433)
>  at 
> org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1341)
>  at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1619)
>  at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
>  at 
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
>  at 
> org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1166)
>  at 
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1390)
>  at 
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1394)
>  at 
> org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1362)
>  at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.NullPointerException
>  at org.apache.felix.http.proxy.ProxyServlet.destroy(ProxyServlet.java:132)
>  at org.apache.catalina.core.StandardWrapper.unload(StandardWrapper.java:1301)
>  ... 15 more
> {code}
> The relevant code is:
> {code:java}
> @Override
> public void destroy()
> {
>  this.tracker.close();
>  super.destroy();
> }{code}
> The ProxyServlet does a lazy call to doInit() on the first incoming service() 
> call.  doInit() will create the tracker instance, otherwise this value is 
> null.
> The fix is to wrap the tracker.close() line with a check to see that the 
> tracker is not null before invoking the close() method.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to