You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by li...@bt.com on 2002/03/08 14:01:08 UTC

How can I resolve this "IllegalStateException: Response has alrea dy been committed" problem?

[TOMCAT-3.3
JDK 1.3.1
WIN 2000]

Hi everyone,

I have a webapp that consists of various servlets - each of which is
associated with one or more JSPs.  The way it works is that someone logs in
(by calling a servlet which forwards them to the JSP form).  This servlet
then processes the input and then (upon successful authorisation) forwards
control to another servlet (which then displays another JSP and handles user
requests from this JSP).  This servlet then processes the user requests and
forwards control to the relevant servlet, which then forwards them to a JSP
page.

My application is working just fine, apart from the fact that I keep getting
these annoying "IllegalStateExceptions".  Here is the full exception:

2002-03-08 11:20:55 - Ctx(/AgentGenerator) : IllegalStateException in R(
/AgentGenerator + /servlet/Create + null) - java.lang.IllegalStateException:
Response has already been committed
        at
org.apache.tomcat.facade.HttpServletResponseFacade.sendError(Unknown Source)
        at
org.apache.tomcat.facade.HttpServletResponseFacade.sendRedirect(Unknown
Source)
        at zeus.generator.web.controllers.Home.goToAddress(Home.java:163)
        at zeus.generator.web.controllers.Home.processRequest(Home.java:120)
        at zeus.generator.web.controllers.Home.doGet(Home.java:131)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
        at org.apache.tomcat.core.Handler.invoke(Unknown Source)
        at org.apache.tomcat.core.Handler.service(Unknown Source)
        at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
        at org.apache.tomcat.core.ContextManager.internalService(Unknown
Source)
        at org.apache.tomcat.core.ContextManager.service(Unknown Source)
        at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown
Source)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
Source)
        at java.lang.Thread.run(Thread.java:484)

2002-03-08 11:20:55 - ErrorHandler: Error loop for R( /AgentGenerator +
/servlet/Create + null) error java.lang.IllegalS
tateException: Response has already been committed


I have tried (and tried, and tried, ...)  to find some information on the
web, but have yet to find a solution.  It seems I can't forward more than
once from the same servlet, but I'm not even sure if I'm right about that.

If anyone can shed any light on this issue it would be most appreciated.

Thanks,

Lindsay

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: How can I resolve this "IllegalStateException: Response has alrea dy been committed" problem?

Posted by Vinay Urs <vi...@yahoo.com>.
we had encountered the same problem... the solution is
to clear the output buffer before re-directing the
page in case of errors, u need to put the following
out.clearBuffer();
before your re-directions...

--- lindsay.hamoudi@bt.com wrote:
> [TOMCAT-3.3
> JDK 1.3.1
> WIN 2000]
> 
> Hi everyone,
> 
> I have a webapp that consists of various servlets -
> each of which is
> associated with one or more JSPs.  The way it works
> is that someone logs in
> (by calling a servlet which forwards them to the JSP
> form).  This servlet
> then processes the input and then (upon successful
> authorisation) forwards
> control to another servlet (which then displays
> another JSP and handles user
> requests from this JSP).  This servlet then
> processes the user requests and
> forwards control to the relevant servlet, which then
> forwards them to a JSP
> page.
> 
> My application is working just fine, apart from the
> fact that I keep getting
> these annoying "IllegalStateExceptions".  Here is
> the full exception:
> 
> 2002-03-08 11:20:55 - Ctx(/AgentGenerator) :
> IllegalStateException in R(
> /AgentGenerator + /servlet/Create + null) -
> java.lang.IllegalStateException:
> Response has already been committed
>         at
>
org.apache.tomcat.facade.HttpServletResponseFacade.sendError(Unknown
> Source)
>         at
>
org.apache.tomcat.facade.HttpServletResponseFacade.sendRedirect(Unknown
> Source)
>         at
>
zeus.generator.web.controllers.Home.goToAddress(Home.java:163)
>         at
>
zeus.generator.web.controllers.Home.processRequest(Home.java:120)
>         at
>
zeus.generator.web.controllers.Home.doGet(Home.java:131)
>         at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java)
>         at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java)
>         at
>
org.apache.tomcat.facade.ServletHandler.doService(Unknown
> Source)
>         at
> org.apache.tomcat.core.Handler.invoke(Unknown
> Source)
>         at
> org.apache.tomcat.core.Handler.service(Unknown
> Source)
>         at
>
org.apache.tomcat.facade.ServletHandler.service(Unknown
> Source)
>         at
>
org.apache.tomcat.core.ContextManager.internalService(Unknown
> Source)
>         at
>
org.apache.tomcat.core.ContextManager.service(Unknown
> Source)
>         at
>
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown
> Source)
>         at
>
org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown
> Source)
>         at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
> Source)
>         at java.lang.Thread.run(Thread.java:484)
> 
> 2002-03-08 11:20:55 - ErrorHandler: Error loop for
> R( /AgentGenerator +
> /servlet/Create + null) error java.lang.IllegalS
> tateException: Response has already been committed
> 
> 
> I have tried (and tried, and tried, ...)  to find
> some information on the
> web, but have yet to find a solution.  It seems I
> can't forward more than
> once from the same servlet, but I'm not even sure if
> I'm right about that.
> 
> If anyone can shed any light on this issue it would
> be most appreciated.
> 
> Thanks,
> 
> Lindsay
> 
> --
> To unsubscribe:  
> <ma...@jakarta.apache.org>
> For additional commands:
> <ma...@jakarta.apache.org>
> Troubles with the list:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>