Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] [Stable 9.2.3.v20140905] java.lang.IllegalStateException: Response is committed in filterChain.doFilter

Joakim - thanks for reviewing the code, and creating the bug. Quick followup question - do you know how long a bug like this usually takes to fix? I can understand that there are no guarantees, I'm just looking for a rough estimate - a few days, a few months, etc. I'm curious because the project I'm working on will be rolling out in the next month and a half, and I'll need to make a call on whether to wait for the fix or not. Thanks!

On Thu, Oct 9, 2014 at 10:43 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Response being committed, means something in your chain, your servlet, your filter, or your CustomResponseWrapper has already started to write a response, and the effort to add a new session cookie cannot be performed at that point in time. 

Look closer at

Once the response headers have been sent, the response is "committed" and changes to the response / headers can no longer be made.

The last call in your stacktrace, to Request.getSession() is attempting to add an outgoing cookie for the session to the response, but the response has already been started.

Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Thu, Oct 9, 2014 at 8:12 AM, Pikachu Absol <lugia@xxxxxxxxxxxxxxxx> wrote:

I write a filter to do something for the response, and host the war in Stable 9.2.3.v20140905

    public void doFilter (
        ServletRequest request,
        ServletResponse response,
        FilterChain chain
    ) throws IOException, ServletException {
        HttpServletRequest httpRequest = (HttpServletRequest) request;
        HttpServletResponse httpResponse = (HttpServletResponse) response;

        CustomResponseWrapper wrapper = new CustomResponseWrapper(httpResponse);"============is commited:\t" + response.isCommitted());
        chain.doFilter(request, wrapper);

         // code never get here

I got the an exception below:

2014-10-09 22:58:23.124:WARN:oejs.ServletHandler:qtp2128697132-18: /v1/hello
java.lang.IllegalStateException: Response is committed
        at org.eclipse.jetty.server.Request.getSession(
        at org.eclipse.jetty.server.Request.getUserPrincipal(
        at org.springframework.web.servlet.FrameworkServlet.getUsernameForRequest(
        at org.springframework.web.servlet.FrameworkServlet.processRequest(
        at org.springframework.web.servlet.FrameworkServlet.doGet(
        at javax.servlet.http.HttpServlet.service(
        at org.springframework.web.servlet.FrameworkServlet.service(
        at javax.servlet.http.HttpServlet.service(
        at org.eclipse.jetty.servlet.ServletHolder.handle(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
        at org.eclipse.jetty.servlet.ServletHandler.doScope(
        at org.eclipse.jetty.server.session.SessionHandler.doScope(
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
        at org.eclipse.jetty.server.Server.handle(
        at org.eclipse.jetty.server.HttpChannel.handle(
        at org.eclipse.jetty.server.HttpConnection.onFillable(
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
        at org.eclipse.jetty.util.thread.QueuedThreadPool$

Since I can't find any solutions or similar cases on Google, I switch to Stable 8.1.16.v20140903 with the exactly same war, and then the problem just disappear, everything runs fine.

Can somebody help ?


jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top