0 Replies Latest reply on Feb 11, 2009 11:45 AM by Hu Ecko

    What causes javax.faces.application.ViewExpiredException

    Hu Ecko Newbie

      Environment: Web container: Tomcat6.0.18, JSF1.2 + Richfaces/Ajax4JSF + Facelets + Spring + Ibatis

      There is a strange problem in my web application, the problem is:

      There is not session timeout, but the "javax.faces.application.ViewExpiredException" often be thrown when using this web application in internet environment, however in the intranet anything is well, I don't know why.

      Except for session timeout, whether there are any other cases that cause this exception?

      1. When not session timeout, the exception stack look like this: [I don't know why the exception is thrown]


      2009-02-10 15:17:09,546 ERROR [org.ajax4jsf.webapp.BaseXMLFilter] - Exception in the filter chain
      javax.servlet.ServletException: viewId:/html/sale/so/search_so_list.jsf - View /html/sale/so/search_so_list.jsf could not be restored.
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.shinwa.faces.common.AuthorizationFilter.doFilter(AuthorizationFilter.java:103)
      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:525)
      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.Http11Processor.process(Http11Processor.java:845)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.faces.application.ViewExpiredException: viewId:/html/sale/so/search_so_list.jsf - View /html/sale/so/search_so_list.jsf could not be restored.
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:185)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

      2. When session timeout, the exception stack look like this:

      2009-02-10 15:03:09,546 com.sun.faces.lifecycle.Phase doPhase
      严é‡�: JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: ) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@1f3b536]
      2009-02-11 21:17:09,546 ERROR [org.ajax4jsf.webapp.BaseXMLFilter] - Exception in the filter chain
      javax.servlet.ServletException: viewId:/html/sale/so/search_so_list.jsf - View /html/sale/so/search_so_list.jsf could not be restored.
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.shinwa.faces.common.AuthorizationFilter.doFilter(AuthorizationFilter.java:103)
      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:525)
      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.Http11Processor.process(Http11Processor.java:845)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: javax.faces.application.ViewExpiredException: viewId:/html/sale/so/search_so_list.jsf - View /html/sale/so/search_so_list.jsf could not be restored.
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:185)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)


      3. The application uses SERVER state saveing method, and uses com.sun.facelets.FaceletViewHandler, the web.xml file detail is as follow:

      <context-param>
      <param-name>com.sun.faces.verifyObjects</param-name>
      <param-value>false</param-value>
      </context-param>
      <context-param>
      <param-name>com.sun.faces.validateXml</param-name>
      <param-value>false</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-miscellaneous.xml</param-value>
      </context-param>
      <context-param>
      <param-name>webAppRootKey</param-name>
      <param-value>WAAJ.root</param-value>
      </context-param>
      <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/config/appContext.xml,/WEB-INF/config/dataAccessContext.xml</param-value>
      </context-param>
      <context-param>
      <param-name>log4jConfigLocation</param-name>
      <param-value>/WEB-INF/config/log4j.xml</param-value>
      </context-param>
      <context-param>
      <param-name>org.richfaces.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>
      <context-param>
      <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
      <param-value>com.sun.facelets.FaceletViewHandler</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
      </context-param>
      <context-param>
      <param-name>org.richfaces.LoadScriptStrategy</param-name>
      <param-value>ALL</param-value>
      </context-param>
      <context-param>
      <param-name>org.richfaces.LoadStyleStrategy</param-name>
      <param-value>ALL</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
      </context-param>
      <context-param>
      <param-name>facelets.BUFFER_SIZE</param-name>
      <param-value>500000</param-value>
      </context-param>

      <display-name>Ajax4jsf Filter</display-name>
      <filter-name>ajax4jsf</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>
      <init-param>
      <param-name>createTempFiles</param-name>
      <param-value>false</param-value>
      </init-param>
      <init-param>
      <param-name>maxRequestSize</param-name>
      <param-value>20000000</param-value>
      </init-param>
      <init-param>
      <param-name>forceparser</param-name>
      <param-value>false</param-value>
      </init-param>

      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>

      <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>


      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>


      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>
      <session-config>
      <session-timeout>30</session-timeout>
      </session-config>
      <welcome-file-list>
      <welcome-file>/index.jsp</welcome-file>
      </welcome-file-list>
      <error-page>
      <exception-type>javax.faces.application.ViewExpiredException</exception-type>
      /errorPages/ViewExpired.jsp
      </error-page>
      <error-page>
      <error-code>403</error-code>
      /errorPages/403.jsp
      </error-page>
      <error-page>
      <error-code>404</error-code>
      /errorPages/404.jsp
      </error-page>
      <error-page>
      <error-code>408</error-code>
      /errorPages/ViewExpired.jsp
      </error-page>
      <error-page>
      <error-code>500</error-code>
      /errorPages/500.jsp
      </error-page>
      <security-constraint>
      <web-resource-collection>
      <web-resource-name>All Pages</web-resource-name>
      <url-pattern>/html/*</url-pattern>
      <url-pattern>/errorPages/*</url-pattern>
      <http-method>POST</http-method>
      <http-method>GET</http-method>
      </web-resource-collection>
      <auth-constraint>
      <role-name>PUBLIC</role-name>
      </auth-constraint>
      </security-constraint>
      <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>WAAJ DataSource Realm</realm-name>
      <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/errorPages/canotauth.jsp</form-error-page>
      </form-login-config>
      </login-config>
      <security-role>
      <role-name>PUBLIC</role-name>
      </security-role>
      <resource-ref>
      <res-ref-name>jdbc/WAAJdb</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
      </resource-ref>



      Thank you very much!