10 Replies Latest reply on Jan 22, 2010 2:20 AM by gamba

    ViewExpiredException will be planed to be resolved in the fu

    qinfeng0152


      I thought richfaces will magically solve the famous problem of "ViewExpiredException", but after I test the official demo of richfaces, I know the answer is "no".

      Does any body know how to solve this problem?

      or

      Is richfaces team going to solve this problem in the future?

      Thank you for your answer.

        • 1. Re: ViewExpiredException will be planed to be resolved in th
          nbelaevski

          Hi,

          Cannot agree with you. Livedemo handles this exception gently for AJAX requests by providing special confirmation popup. Have you tried configuring error page for ViewExpiredException in web.xml?

          • 2. Re: ViewExpiredException will be planed to be resolved in th
            qinfeng0152

            good idea nbelaevski, I will try to modify my web.xml

            Concerning the live demo, after entering in a page, and then wait for something like 30 minute, when I click a component, it gives me a ViewExpiredException page which offered by Tomcat 5.5

            I don't get it when you say this problem is solved by Ajax way.

            Thank you for your answer.

            • 3. Re: ViewExpiredException will be planed to be resolved in th
              nbelaevski

              What component do you click?

              • 4. Re: ViewExpiredException will be planed to be resolved in th
                qinfeng0152

                In live demo :http://livedemo.exadel.com/richfaces-demo/index.jsp

                Every component demo page, you have a tab table where usually you could find "usage" and "tag information".

                Just try a component page, for example : data table. Open the page. After 1 or 2 hours, click "tag information", you will have what I said "ViewExpiredException" page, which is an error page http 500 given by tomcat 5.5.20

                • 5. Re: ViewExpiredException will be planed to be resolved in th
                  nbelaevski

                  Yes, these tabs are not configured to use AJAX switching, so it's not caught as I've said. Try the same with any AJAXed component, e.g. at a4j:support demo.

                  • 6. Re: ViewExpiredException will be planed to be resolved in th
                    gamba

                    I clicked on a4j:support and after 30minutes I get this exception, when clicking on tag-information:

                     

                    javax.servlet.ServletException: viewId:/richfaces/support.jsf - View /richfaces/support.jsf could not be restored.
                         javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
                         org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                         org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
                         org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                            ...
                    
                    

                    root cause

                     

                     

                    javax.faces.application.ViewExpiredException: viewId:/richfaces/support.jsf - View /richfaces/support.jsf could not be restored.      com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:185)      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)      com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)      javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)      org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)      org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)      org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)      org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

                    ....


                    So I don't think this error is fixed in the current release 3.3.2.SR1.

                     

                    BTW: In my application I'm getting the damned ViewExpiredException too. After upgrading to facelets 1.1.15 the following exceptions occurs.

                    But there is no session timeout. Shortly after starting the app and clicking around the error occurs ... ok, one thing to say ... I'm starting my own thread inside a rich:progressBar ...

                     

                    javax.faces.application.ViewExpiredException: viewId:/pages/renderPDF.jsf - View /pages/renderPDF.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 org.jboss.portletbridge.AjaxPortletBridge.execute(AjaxPortletBridge.java:1076)
                        at ...
                    14:24:28,437 ERROR [STDERR] org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                        at org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker$invoke_N8654503705355129869.invokeNext(ProducerPortletInvoker$invoke_N8654503705355129869.java)
                        at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                        at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                        at org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker$invoke_N8654503705355129869.invokeNext(ProducerPortletInvoker$invoke_N8654503705355129869.java)
                        at org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker.invoke(ProducerPortletInvoker.java)
                        at org.jboss.portal.portlet.federation.impl.FederatedPortletInvokerService.invoke(FederatedPortletInvokerService.java:145)
                        at org.jboss.portal.portlet.federation.impl.FederatingPortletInvokerService.invoke(FederatingPortletInvokerService.java:149)
                        at org.jboss.portal.core.model.instance.InstanceInvoker.invoke(InstanceInvoker.java:42)
                        at ...
                    14:24:28,437 ERROR [STDERR] org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:38)
                        at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
                        at org.jboss.portal.core.impl.api.user.UserEventBridgeTriggerInterceptor.invoke(UserEventBridgeTriggerInterceptor.java:65)
                        at org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:38)
                        at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
                        at ...
                        at java.lang.Thread.run(Thread.java:595)
                    14:24:28,437 ERROR [de_handelshof_pis_web_portlets_PDFPanelPortlet] The portlet threw an exception
                    javax.portlet.PortletException: Error process faces request
                        at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:543)
                        at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:574)
                        at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:184)
                        at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:84)
                        at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:505)
                        at ...
                        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                        at java.lang.Thread.run(Thread.java:595)
                    Caused by: javax.portlet.faces.BridgeException: java.lang.NullPointerException
                        at org.jboss.portletbridge.richfaces.RichFacesStrategy.finishResponse(RichFacesStrategy.java:127)
                        at org.jboss.portletbridge.richfaces.RichFacesStrategy.finishResponse(RichFacesStrategy.java:217)
                        at org.jboss.portletbridge.BridgeStrategyWrapper.finishResponse(BridgeStrategyWrapper.java:80)
                        at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:820)
                        at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:541)
                        ... 195 more
                    Caused by: java.lang.NullPointerException
                        at org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:401)
                        at org.jboss.portletbridge.richfaces.RichFacesStrategy.finishResponse(RichFacesStrategy.java:113)
                        ... 199 more
                    14:24:28,453 ERROR [DefaultPortalControlPolicy] Rendering portlet window  produced an error
                    javax.portlet.PortletException: Error process faces request
                        at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:543)
                        at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:574)
                        at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:184)
                        at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:84)
                        at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:505)
                        at org.jboss.portal.portlet.container.ContainerPortletDispatcher.invoke(ContainerPortletDispatcher.java:42)
                        at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                        at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org$jboss$portal$core$aspects$portlet$TransactionInterceptor$invokeNotSupported$aop(TransactionInterceptor.java:97)
                        at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N6922078035659651697.invokeNext(TransactionInterceptor$invokeNotSupported_N6922078035659651697.java)
                        at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
                    

                     

                    I'm using PortletBridge 2.0.0.CR1, RichFaces 3.3.2.SR1, facelets_1.1.15 and jsf-api_1.2_13

                     

                    Thx,

                    Holger

                    • 7. Re: ViewExpiredException will be planed to be resolved in th
                      nbelaevski

                      Holger,

                       

                      Exception is happening because in the demo tab panel is configured to be switched via common server submit. If it was AJAX, then you would have seen message box for message expiration and not the exception.

                       

                      On the PortletBridge - there can be issues with PB itself, have you asked about this at their forum?

                      • 8. Re: ViewExpiredException will be planed to be resolved in th
                        gamba

                        Nick, thx for explanation. I'm also using switchType="server", but changing it to "ajax"

                        no wizard for custom ajax-error handling is shown.

                         

                        In web.xml I've placed the following context-param:

                         

                          <context-param>
                            <param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
                            <param-value>true</param-value>
                          </context-param>    
                        

                         

                        Ok, nevertheless I will post the other error in the bridge forum.

                        • 9. Re: ViewExpiredException will be planed to be resolved in th
                          nbelaevski
                          You should add JavaSrcipt handler function, like on the demo.
                          • 10. Re: ViewExpiredException will be planed to be resolved in th
                            gamba

                            I already added it to my *.xhtml sites ...

                             

                            <?xml version="1.0" encoding="utf-8"?>
                            <ui:composition xmlns="http://www.w3.org/1999/xhtml" 
                                      xmlns:h="http://java.sun.com/jsf/html"
                                      xmlns:f="http://java.sun.com/jsf/core" 
                                      xmlns:ui="http://java.sun.com/jsf/facelets" 
                                      xmlns:a4j="http://richfaces.org/a4j"
                                      xmlns:rich="http://richfaces.org/rich">
                            
                                 <script type="text/javascript">
                                      
                                     A4J.AJAX.onError = function(req,status,message){
                                     window.alert("Custom onError handler "+message);
                                   }
                            
                                       
                                   A4J.AJAX.onExpired = function(loc,expiredMsg){
                                     if(window.confirm("Custom onExpired handler "+expiredMsg+" for a location: "+loc)){
                                       return loc;
                                     } else {
                                      return false;
                                     }
                                   } 
                                 </script>
                            ...
                            

                             

                            ... this composition is included in an other one, and I added the script in the other one too ...

                             

                            <?xml version="1.0" encoding="utf-8"?>
                            <ui:composition xmlns="http://www.w3.org/1999/xhtml" 
                                            xmlns:h="http://java.sun.com/jsf/html"
                                            xmlns:f="http://java.sun.com/jsf/core" 
                                            xmlns:ui="http://java.sun.com/jsf/facelets" 
                                            xmlns:a4j="http://richfaces.org/a4j"
                                            xmlns:rich="http://richfaces.org/rich" 
                                            template="../templates/hmg_template.xhtml">
                            
                                <ui:define name="content">    
                                
                                    <script type="text/javascript">
                                        // Error-Handling fuer Exceptions bei Ajax-Requests
                                      A4J.AJAX.onError = function(req,status,message){
                                        window.alert("Custom onError handler "+message);
                                      }
                                
                                         // Error-Handling fuer Session-Timeouts bei Ajax-Requests
                                      A4J.AJAX.onExpired = function(loc,expiredMsg){
                                        if(window.confirm("Custom onExpired handler "+expiredMsg+" for a location: "+loc)){
                                          return loc;
                                        } else {
                                         return false;
                                        }
                                      } 
                                    </script>
                                
                                    <rich:spacer height="5px" width="100%" />
                                    
                                
                                    <a4j:keepAlive beanName="tabControllerBean" />        
                                    
                                    <rich:tabPanel id="tabPanel" switchType="server" selectedTab="#{tabBean.selectedTab}" 
                                                                 width="315" height="450" tabClass="pisMenuTabItem">
                                                        
                                        <rich:tab id="scanTab" eventsQueue="scanTabQueue" requestDelay="500" ignoreDupResponses="true"  
                                          <f:facet name="label">  
                                             <h:graphicImage id="scanImage" value="#{msg.imageScanner2}" styleClass="pisMenuTabItemImageClass />
                                          </f:facet>                                        
                                        
                                          <a4j:include viewId="menuContent/contentScan.xhtml" />
                                       </rich:tab>                             
                                        
                                       
                                     <rich:tab id="classifyTab" eventsQueue="classifyTabQueue" requestDelay="500" ignoreDupResponses="true">
                                      ...