tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: NullPointerException in Response.generateCookieString()
Date Mon, 17 Jul 2017 09:26:39 GMT
On 17/07/17 09:59, Matthias Keller wrote:
> Hi
> 
> In our production environment we (sometimes but still often enough) have
> the problem, that we get an NPE deep within the Response object.
> 
> This occurs under 8.5.13 and 8.5.16.
> 
> The stacktrace (from 8.5.13) is as follows:
> 
> org.apache.catalina.connector.Response.generateCookieString(Response.java:999)
> org.apache.catalina.connector.Response.addCookie(Response.java:947)
> org.apache.catalina.connector.ResponseFacade.addCookie(ResponseFacade.java:386)
> javax.servlet.http.HttpServletResponseWrapper.addCookie(HttpServletResponseWrapper.java:58)
> javax.servlet.http.HttpServletResponseWrapper.addCookie(HttpServletResponseWrapper.java:58)
> javax.servlet.http.HttpServletResponseWrapper.addCookie(HttpServletResponseWrapper.java:58)
> 
> The code leading to it is:
> 
> Cookie c = new Cookie(cookieName, "");
> c.setMaxAge(0);
> cookie.setPath(contextPath);
> response.addCookie(cookie);
> 
> We use the LegacyCookieProcessor via tomcat's context.xml:
> 
> <CookieProcessor className="org.apache.tomcat.util.http.LegacyCookieProcessor" />
> 
> It appears that the context object is null in those cases (which I can
> confirm using the debugger), but I have no clue as of why this could be
> happening? Especially since it doesn't happen every time.
> 
> Any clues or hints? What could I do to debug this problem?

Where / when is this code running?

How are you obtaining the response object?

> BTW this doesn't happen on Tomcat 7.0.77

That might be timing related. There was a lot of refactoring of the
Connector code between 7.0.x and 8.5.x.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message