6 Replies Latest reply on Aug 16, 2012 6:20 AM by kelly goedert

    ViewExpiredException in a cluster environment

    k l Newbie

      Hello,

       

      I have a test application using richfaces, and I am currently testing it in a cluster environment.

      The application consists of a simple page with a rich:tabpanel component, the code is as follow :

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      <html>
      <head>
      <title>Test - JSF</title>
      </head>
      <body>
      <f:view>
        <rich:tabPanel switchType="ajax">
          <rich:tab label="one"></rich:tab>
          <rich:tab label="two">
            <a4j:form id="myform_id">
              <h:inputText value="#{mybean.a}"/>
              <h:inputText value="#{mybean.b}"/>
              <h:outputText value="#{mybean.result}" />
              <a4j:commandButton type="submit" action="#{mybean.submit}"
                value="Submit" reRender="myform_id" id="submit" />
            </a4j:form>
          </rich:tab>
          <rich:tab label="three"></rich:tab>
        </rich:tabPanel>
      </f:view>
      </body>
      </html>
      

       

      mybean is mapped to the class MyBean with a session scope. MyBean implements Serializable.

       

      Before testing in a cluster environment, I checked these two points were valid :

      - All classes implement Serializable

      - web.xml contains <distributable />

       

      The application server is Tomcat 6.0.18 with Apache 2.0 and mod_jk and works with RichFaces 3.3.2 SR1.

       

      In this application, the index.jsf is loaded correctly, but when I click on the tab "Two" or "Three", I get this error message :

      ERROR [TP-Processor3] org.ajax4jsf.webapp.BaseXMLFilter [] - Exception in the filter chain
      javax.servlet.ServletException: viewId:/index.jsf - View /index.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:178)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
           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.core.StandardHostValve.invoke(StandardHostValve.java:128)
           at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
           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.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
           at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
           at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
           at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
           at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
           at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
           at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.faces.application.ViewExpiredException: viewId:/index.jsf - View /index.jsf could not be restored.
           at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:186)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
           at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
           ... 22 more
      

       

      I wonder if RichFaces works in a cluster environment, does someone did it ?

      Is there a solution to avoid this error ?

       

      Thanks by advance for your help.

       

      Kevin