Hi all,
I'm running into a problem in a struts application I'm working on.
In my struts-config.xml, I have this action-mapping:
<action path="/register"
scope="session"
name="RegistrationForm"
type="com.foo.RegistrationAction">
<forward name="success" path="/index.jsp" redirect="true"/>
<forward name="failure" path="/register.jsp" redirect="true"/>
</action>
The RegistrationAction.execute() method takes several request parameters
and uses them to create an account; when this is successful, it returns
mapping.findForward("success"), and otherwise, it returns
mapping.findForward("failure").
For reasons I have not been able to determine, the redirection often
fails. RegistrationAction.execute() will run successfully, the
mapping.findForward() succeeds and finds the correct forward, which is
then returned -- but an exception is thrown while the redirect is sent
to the client. This is the full log output:
Jan 9, 2008 11:11:35 AM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.IllegalStateException
at
org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
at
org.apache.struts.chain.commands.servlet.PerformForward.handleAsRedirect(PerformForward.java:125)
at
org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:94)
at
org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Jan 9, 2008 11:11:35 AM org.apache.catalina.core.StandardHostValve custom
SEVERE: Exception Processing
ErrorPage[exceptionType=java.lang.Exception, location=/error.jsp]
java.lang.IllegalStateException
at org.apache.coyote.Response.reset(Response.java:297)
at org.apache.catalina.connector.Response.reset(Response.java:652)
at org.apache.catalina.connector.Response.reset(Response.java:916)
at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:417)
at
org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:271)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
I understand that the second exception happens because, after sending a
redirect, it is no longer possible to forward to the error page, but
what is a complete mystery to me is why the first exception occurs.
RegistrationAction.execute() never touches the response, so struts
should have no problem sending the redirect to /index.jsp (or back to
/register.jsp, in the case of failure).
This exception does not happen consistently. Sometimes it does,
sometimes it doesn't, with no pattern that I have been able to find.
Even when I post the exact same request over and over.
I'm using Struts 1.3 and Tomcat 6.0.14.
- Thomas
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]