Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Not A Problem
-
2.1.6
-
None
-
None
-
Important
Description
I have a big problem after upgrading to Struts 2.1.6. My application works fine when using Struts 2.0.11. After upgrading to Struts 2.1.6, the application keep showing a "Blank Page" randomly (sometimes it happen, and quite often, but no pattern at all) when struts try to redirect to other action. I'm in devMode = false, and the log shows an exception like this:
[2009-04-28 16:49:16,374]DEBUG ServletRedirectResult:57 - Redirecting to finalLocation /pages/home.action?
Apr 28, 2009 4:49:16 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407)
at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:108)
at com.opensymphony.module.sitemesh.filter.PageResponseWrapper.sendError(PageResponseWrapper.java:176)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:725)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:127)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:63)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:65)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
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:286)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Unknown Source)
[2009-04-28 16:49:16,376]DEBUG DisposableBeanAdapter:203 - Invoking destroy method 'close' on bean with name 'hibernateSession'
[2009-04-28 16:49:16,376]DEBUG HibernateSession:60 - closing hibernateSession
[2009-04-28 16:49:16,376]DEBUG RequestContextListener:89 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1eb2473
Apr 28, 2009 4:49:16 PM 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:658)
at org.apache.catalina.connector.Response.reset(Response.java:925)
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:286)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Unknown Source)
I have made a little adjustment due to an issue in Sitemesh 2.3 PageFilter, you can see the issue here:
http://jira.opensymphony.com/browse/SIM-151
To fix the sitemesh issue, I have to make a replacement class for default PageFilter (because struts 2 doesn't support latest Sitemesh 2.4.1), and remove the code "request.getSession(true);".
The "blank page" I said previously is happening before and after I have created a new PageFilter, so the changes I've made wont be a matter.
In the test case, I try to login and log out repeatedly, and a blank page keep shows up (randomly) when try to redirect form login.action to home.action. the web.xml settings:
<filter>
<filter-name>struts2-prepare</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
</filter>
<filter>
<filter-name>velocity</filter-name>
<filter-class>org.apache.struts2.sitemesh.VelocityPageFilter</filter-class>
</filter>
<filter>
<filter-name>struts2-execute</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2-prepare</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>velocity</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2-execute</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
The login and logout action XML:
<action name="login" class="com.cpssoft.action.menus.general.LoginAction">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="language" />
<result name="input" type="velocity">/pages/general/login.vm</result>
<result name="success" type="redirect"> ${originalUrl}</result>
</action>
<action name="logout" class="com.cpssoft.action.menus.general.LoginAction"
method="logout">
<interceptor-ref name="defaultStack" />
<interceptor-ref name="language" />
<result name="input" type="velocity">/pages/general/login.vm</result>
</action>
${originalUrl} will be filled with: "/pages/home.action" (See the exception above).
Any Idea how to fix this issue?
Thx a lot