Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IllegalStateException on struts action chaining

10 views
Skip to first unread message

Sanjay

unread,
Jul 9, 2002, 10:27:13 AM7/9/02
to
Hi,

I am using Struts 1.1b1 with WAS 4.02.

In one of my action I am forwarding to another action which in turn forwards
to the final JSP.

I always get the error pasted below. This does not cause any harm, other
then cluttering up the log file.
I have read that the workaround is to use redirect instead of forward for
the intermediary action.
But I would prefer to use forward and also avoid this error message.

I don't get any errors when running on WSAD 4.02 's WTE, its only when I am
running on WAS 4.02

I would appreciate any help.
Thanks,
Sanjay
-------------------------------- Error message ------------------

[7/8/02 17:04:04:906 EDT] 3ce2be0b WebGroup X Servlet Error: ERROR:
Cannot forward. Response already committed.:
java.lang.IllegalStateException: ERROR: Cannot forward. Response already
committed.
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD
ispatcher.java:92)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:97
2)
at
org.apache.struts.action.RequestProcessor.processActionForward(RequestProces
sor.java:408)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:269)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager
.java:827)
at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycl
eServlet.java:167)
at
com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServle
t.java:297)
at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycle
Servlet.java:110)
at
com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:47
2)
at
com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletMan
ager.java:1012)
at
com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManag
er.java:913)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(W
ebAppRequestDispatcher.java:523)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequest
Dispatcher.java:282)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD
ispatcher.java:112)
at
com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:91)
at
com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.
java:184)
at
com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedIn
vocation.java:67)
at
com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(Cacheabl
eInvocationContext.java:106)
at
com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequ
estProcessor.java:125)
at
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener
.java:315)
at
com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.ja
va:60)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)


ОТ

unread,
Jul 13, 2002, 7:10:16 AM7/13/02
to
yeap!
finally someone got the same error with me,which bothers me for days!I've
refered to the IBM support center and what they say is as belows:
"
As to sendRedirect, would you help me in explaining what exact
meaning with "response commited"

- you can download servlet 2.2 specification from http://java.sun.com,
was4.0 is j2ee 1.2 certified, so it has to do as specification and your
source code should also do as it."
I am not completed understandable with their answer.
I am using WAS version 4.0.1,they also recommand me upgrade to version
4.0.3,
I am not aware whether this is helpful with the problem.

Anyone will help? GREAT appreciated!

Tommy

"Sanjay" <sg...@opers.org> wrote in message
news:agerjb$1kn2$1...@news.boulder.ibm.com...

?

unread,
Jul 13, 2002, 11:09:23 AM7/13/02
to
I am not writing any output to response before sendRedirect method,then how
it could be "trying to redirect (or add any HTTP header) to the response
after
some of the response has already gone to the browser" happen?
In addition,I do not see the app perform error but only logging in the
websphere,will that harm to the running application?
Thank you for your help.
Tommy
"Ken Hygh" <ken...@nc.rr.com> wrote in message
news:3D303E2D...@nc.rr.com...
> sendRedirect() sends an HTTP Response of 302 back to the browser - in
> the HTTP response headers.
>
> However, if you've already written stuff back to the browser, then
> there's no way for the browser to correctly interpret something in the
> header, because it's already read the header.
>
> Thus, trying to redirect (or add any HTTP header) to the response after
> some of the response has already gone to the browser, is not allowed by
> the spec.
> Ken

Ken Hygh

unread,
Jul 13, 2002, 10:50:21 AM7/13/02
to
sendRedirect() sends an HTTP Response of 302 back to the browser - in
the HTTP response headers.

However, if you've already written stuff back to the browser, then
there's no way for the browser to correctly interpret something in the
header, because it's already read the header.

Thus, trying to redirect (or add any HTTP header) to the response after
some of the response has already gone to the browser, is not allowed by
the spec.
Ken

Ken Hygh

unread,
Jul 13, 2002, 10:15:16 PM7/13/02
to
If you aren't seeing an error in your application, then I'd ignore the
message.
Ken

?

unread,
Jul 14, 2002, 9:59:52 AM7/14/02
to
Thanx


"Ken Hygh" <ken...@nc.rr.com> wrote in message

news:3D30DEB4...@nc.rr.com...

Art Smet

unread,
Jul 15, 2002, 10:53:04 AM7/15/02
to
Consistent with what you are saying, the stack dump shows a .forward( ) is being
attempted. However, that action is raising an IllegalStateException because the
response is already committed. There are several reasons that can cause a
response to be committed, and it may be difficult to hunt down exactly where the
commit of the response is happening. Basically "commit" means enough of the
response has already be sent back to the browser, and so using .forward( ) to
initiate the start of a new response is illegal. One way to commit a response
is to issue a sendRedirect( ) and if immediately followed by a .forward( ) -
this will cause the IllegalStateException. The reason things otherwise "seem to
work", is that whatever was sent back to the browser originally was the proper
response, and the subsequent .forward( ) flow that takes the
IllegalStateException is logged but irrelevant.
0 new messages