8 Replies Latest reply on Nov 9, 2009 4:14 PM by Damian Harvey

    ViewExpiredException on Login page.

    Diego Y K Newbie

      I'm using Seam Security on my application, with form based authentication.


      But I'm getting a ViewExpiredException if the user stays on Login page until Session Timeout. Is there any way to prevent that from happenning?


        • 1. Re: ViewExpiredException on Login page.
          Aldo Bonzi Novice

          I think you'd have more chances to get an accurate answer if you post relevant source code.

          • 2. Re: ViewExpiredException on Login page.
            Leo van den berg Master

            Catch the exception with a definition in pages.xml which returns to the login view.


            Something like the following


            <exception class="javax.faces.application.ViewExpiredException">
                 <redirect view-id="your-login.xhtml">
                      <message>View expired, login again!</message>
                 </redirect>
            </exception>
            



            • 3. Re: ViewExpiredException on Login page.
              Diego Y K Newbie

              I've done the exception control on pages.xml. But my problem isn't a redirection one.


              My problem is that when a user stays on the login page without entering his user name or password for a period long enough so that the session timeouts and then enters the Username and Password and click on Login button I got the message from the expired View.


              But the user isn't logged in yet, so it's unacceptable to show such a message when clicking login Button. What I want to do is to prevent the view from expiring if it's on Login page.


              Is it possible?

              • 4. Re: ViewExpiredException on Login page.
                Scott Basinger Newbie
                Not sure if this will help you, but I had all sorts of viewExpiredExceptions when using Facelets and RichFaces.  The resolution for me was to remove the FaceletsViewHandler from the faces-config.xml and put this in the web.xml:

                <!-- ViewExpiredException handling BEGIN -->     
                        <context-param>
                                <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                                <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                        </context-param>
                <!--         unnecessary with richfaces 3.3.1 -->
                        <context-param>
                        <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
                        <param-value>true</param-value>
                        </context-param> 
                <!-- ViewExpiredException handling END -->       
                • 5. Re: ViewExpiredException on Login page.
                  Diego Y K Newbie

                  So your faces-config.xml now is empty?


                  • 6. Re: ViewExpiredException on Login page.
                    Stefano Travelli Newbie

                    It's a common problem on JSF applications.


                    Take a look at this thread in the forum: wiki://57423


                    and at this thread in the seam-dev mailing list: http://www.nabble.com/PARAM_BUILD_BEFORE_RESTORE-td19330744.html.




                    • 7. Re: ViewExpiredException on Login page.
                      blabno Master

                      Hi!


                      I've got



                      <exception class=\"javax.faces.application.ViewExpiredException\">
                           <redirect view-id=\"your-login.xhtml\">
                                <message>View expired, login again!</message>
                           </redirect>
                      </exception>



                      set up but I'm still getting ViewExpiredException in loggs. Should this exception be logged since it is caught ? I don't think so. So what am I missing ?



                      javax.servlet.ServletException: viewId:/login.seam - View /login.seam could not be restored.
                              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:249)
                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                              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.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                              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:230)
                              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                              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:262)
                              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                              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:619)
                      Caused by: javax.faces.application.ViewExpiredException: viewId:/login.seam - View /login.seam could not be restored.
                              at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:187)
                              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                              ... 38 more

                      • 8. Re: ViewExpiredException on Login page.
                        Damian Harvey Apprentice

                        It always hits the logs even if handled. Old old issue - search the old forum for it.