myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bansi <mail2ba...@yahoo.com>
Subject Re: Session timeout results in javax.faces.application.ViewExpiredException
Date Fri, 18 Jul 2008 20:22:26 GMT

the following code snippet in web.xml

<error-page>
    
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
    	<location>/sessionTimeout.jsp</location>
    </error-page>



It doesnt work meaning it doesnt render sessionTimeout.jsp infact throws up
the stack Trace on the browser

I am using Tomcat 5.6, JSF 1.2(MyFaces 1.2.2), facelets 1.1.13 

Martin Marinschek wrote:
> 
> Hi,
> 
> you should probably write a filter or a phase-listener to deal with
> session-timeouts appropriately.
> 
> regards,
> 
> Martin
> 
> On Fri, Jul 18, 2008 at 7:01 PM, bansi <mail2bansi@yahoo.com> wrote:
> 
>>
>> Hi Martin
>> Thanks for sharing your thoughts. My web.xml doesnt have any
>> configuration
>> related to session timeout so i guess its uses default timeout. A code
>> snippet on how to do a post-back will be greatly appreciated
>>
>>
>> Martin Marinschek wrote:
>> >
>> > Hi,
>> >
>> > yes, I would dare to say this is expected behaviour, if you do a
>> > post-back (if you execute a get-link, then this shouldn't happen). In
>> > your web-application, you will need to cover the case of a timed-out
>> > session appropriately.
>> >
>> > regards,
>> >
>> > Martin
>> >
>> > On 7/18/08, bansi <mail2bansi@yahoo.com> wrote:
>> >>
>> >> I am using Myfaces 1.2.2 ( JSF 1.2) and PhaseListener approach as
>> >> suggested
>> >> by Cagatay Civici in one of his articles i.e.
>> >>
>> http://cagataycivici.wordpress.com/2005/12/30/jsf_with_ajax_phase_listener/
>> >>
>> >> If the session times out, JSF throws a ViewExpiredException during the
>> >> RESTORE_VIEW phase.
>> >>
>> >>
>> >> Here is the snippet from my LoginPhaseListener. The exception is
>> thrown
>> >> from
>> >> afterPhase method
>> >>
>> >>  /**
>> >>      * After phase.
>> >>      *
>> >>      * @param pe
>> >>      *            the pe
>> >>      * @see
>> >>
>> javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
>> >>      */
>> >>     public void afterPhase(final PhaseEvent pe)
>> >>     {
>> >>         final FacesContext facesContext = pe.getFacesContext();
>> >>         final String viewId =
>> >> pe.getFacesContext().getViewRoot().getViewId();// Throws Exception
>> >>         if (viewId.endsWith("login.xhtml"))
>> >>         {
>> >>             final String managedBeanName =
>> >> getManagedBeanNameFromView(viewId);
>> >>             final Object object =
>> >> facesContext.getApplication().createValueBinding("#{" +
>> managedBeanName
>> +
>> >> "}")
>> >>                     .getValue(facesContext);
>> >>             if (object == null)
>> >>             {
>> >>                 logger.error("OnPageLoad cannot be executed, no such
>> >> managed
>> >> bean:" + managedBeanName);
>> >>             } else
>> >>             {
>> >>                 final Login loginBean = (Login) object;
>> >>                 loginBean.onPageLoad();
>> >>             }
>> >>         } else
>> >>         {
>> >>             final String managedBeanName =
>> >> getManagedBeanNameFromView(viewId);
>> >>             final String BackingBeanName =
>> managedBeanName.substring(0,
>> >> 1).toUpperCase()
>> >>                     + managedBeanName.substring(1,
>> >> managedBeanName.length());
>> >>                    }
>> >>     }
>> >>
>> >>
>> >>  /**
>> >>      * Gets the managed bean name from view.
>> >>      *
>> >>      * @param viewId
>> >>      *            the view id
>> >>      * @return the managed bean name from view
>> >>      */
>> >>     public String getManagedBeanNameFromView(final String viewId)
>> >>     {
>> >>         String pageName;
>> >>         if (viewId.endsWith("login.xhtml"))
>> >>         {
>> >>             pageName = viewId.substring(1, viewId.length() - 6);
>> >>         } else
>> >>         {
>> >>             pageName = viewId.substring(1, viewId.length() - 10);
>> >>         }
>> >>         return pageName + "Bean";
>> >>     }
>> >>
>> >> Here is the stack trace
>> >>
>> >> 2008-07-15 10:31:12,192 ERROR
>> >> [org.apache.myfaces.lifecycle.PhaseListenerManager] - <Exception in
>> >> PhaseListener RESTORE_VIEW(1) afterPhase>
>> >> java.lang.NullPointerException
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.LoginPhaseListener.afterPhase(LoginPhaseListener.java:47)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:92)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:107)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>> >>      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
>> >>      at
>> org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
>> >>      at
>> >>
>> org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
>> >>      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> >>      at
>> >>
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.SecurityFilter.doFilter(SecurityFilter.java:59)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.MessageFilter.doFilter(MessageFilter.java:71)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>> >>      at
>> >>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>> >>      at
>> >>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>> >>      at
>> >>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>> >>      at
>> >>
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>> >>      at
>> >>
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>> >>      at
>> >>
>> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>> >>      at
>> >>
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>> >>      at java.lang.Thread.run(Thread.java:595)
>> >> 2008-07-15 10:31:12,348 ERROR [javax.faces.webapp._ErrorPageWriter] -
>> <An
>> >> exception occurred>
>> >> javax.faces.application.ViewExpiredException: /deviceForm.facesThe
>> >> expected
>> >> view was not returned for the view identifier: /deviceForm.faces
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>> >>      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
>> >>      at
>> org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
>> >>      at
>> >>
>> org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
>> >>      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> >>      at
>> >>
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.SecurityFilter.doFilter(SecurityFilter.java:59)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.MessageFilter.doFilter(MessageFilter.java:71)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>> >>      at
>> >>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>> >>      at
>> >>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>> >>      at
>> >>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>> >>      at
>> >>
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>> >>      at
>> >>
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>> >>      at
>> >>
>> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>> >>      at
>> >>
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>> >>      at java.lang.Thread.run(Thread.java:595)
>> >> 2008-07-15 10:31:12,348 ERROR [javax.faces.webapp._ErrorPageWriter] -
>> <An
>> >> exception occurred>
>> >> javax.faces.application.ViewExpiredException: /deviceForm.facesThe
>> >> expected
>> >> view was not returned for the view identifier: /deviceForm.faces
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
>> >>      at
>> >>
>> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>> >>      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
>> >>      at
>> org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
>> >>      at
>> >>
>> org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
>> >>      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>> >>      at
>> >>
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.SecurityFilter.doFilter(SecurityFilter.java:59)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> com.boeing.nmt.nams.view.util.MessageFilter.doFilter(MessageFilter.java:71)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>> >>      at
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>> >>      at
>> >>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>> >>      at
>> >>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>> >>      at
>> >>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>> >>      at
>> >>
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>> >>      at
>> >>
>> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>> >>      at
>> >>
>> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>> >>      at
>> >>
>> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>> >>      at
>> >>
>> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>> >>      at java.lang.Thread.run(Thread.java:595)
>> >> 2008-07-15 10:31:12,348 WARN
>> >> [org.apache.myfaces.renderkit.html.util.DefaultAddResource] - <MyFaces
>> >> special javascript could not be retrieved from request-map.>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Session-timeout-results-in-javax.faces.application.ViewExpiredException-tp18518805p18518805.html
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> >
>> > http://www.irian.at
>> >
>> > Your JSF powerhouse -
>> > JSF Consulting, Development and
>> > Courses in English and German
>> >
>> > Professional Support for Apache MyFaces
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Session-timeout-results-in-javax.faces.application.ViewExpiredException-tp18518805p18533647.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/Session-timeout-results-in-javax.faces.application.ViewExpiredException-tp18518805p18537083.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message