Re: [JSF][CORE] No View State Exception
Hi Simon, thanks for your answer. I understand that NoViewStateException is legitimate, if a postback operation was done to the server, and after session expires you try to post data again. But I wonder, if page is only first loaded and no operation was done on it,should the NoViewStateException occure? Can't this state be identified and isolated to prevent NoViewStateException? As it is for today, I do catch the Exception in one of my filters and simply write it to the logs. This causes a very weird behavior on the application, when you try to log in for the first time, then nothing happens and the screen refreshes, and when you try to login for the second time, everything works fine... Thanks, Guy. On Tue, Feb 17, 2009 at 11:11 AM, Simon Kitching wrote: > Guy Bashan schrieb: > > I am having a weird issue with JSF: I set the session expiration in my > > application to 1 minute (for testing purposes). I load the web > > application. the entrance page is a simple login page with 2 fields > > (username/password). I wait for 1 minute for session to expire. I try to > > login. I get this exception: > > > > > > 2009-02-17 10:48:33,522 [http-8080-2] ERROR > > org.ajax4jsf.webapp.BaseXMLFilter - Exception in the filter chain > > > > javax.servlet.ServletException: /login.jspxNo saved view state could be > > found for the view identifier: /login.jspx > > < > > Caused by: javax.faces.application.ViewExpiredException: /login.jspxNo > > saved view state could be found for the view identifier: /login.jspx > > > > at > > > org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88) > > > > > > Why am I getting it? this is really annoying... > > This is expected. Your page submit is including the id of a server-side > view state that no longer exists - what should the server do in this > case? No "postback" processing can occur when the view cannot be > restored, as there are no JSF input or command components to look for > data in the submitted form. > > You can use the element in the web.xml to cause a redirect > to the login page (or some other page). The original url and thrown > exception (and its causes) are available as request-scoped objects I think. > > Or use a filter to catch the ViewExpiredException and do whatever you > want in this case. > > Or put some javascript in the login page that "pings" the server every > few minutes, so the session does not expire. > > Or avoid using JSF for the login page. You'll still have this issue on > other pages, but it is more understandable to the user that they have > "timed out" on some page in the middle of the app rather than having > "timed out" in the login page. > > Regards, > Simon > -- > -- Emails in "mixed" posting style will be ignored > -- (http://en.wikipedia.org/wiki/Posting_style) >
Re: [JSF][CORE] No View State Exception
Guy Bashan schrieb: > I am having a weird issue with JSF: I set the session expiration in my > application to 1 minute (for testing purposes). I load the web > application. the entrance page is a simple login page with 2 fields > (username/password). I wait for 1 minute for session to expire. I try to > login. I get this exception: > > > 2009-02-17 10:48:33,522 [http-8080-2] ERROR > org.ajax4jsf.webapp.BaseXMLFilter - Exception in the filter chain > > javax.servlet.ServletException: /login.jspxNo saved view state could be > found for the view identifier: /login.jspx > < > Caused by: javax.faces.application.ViewExpiredException: /login.jspxNo > saved view state could be found for the view identifier: /login.jspx > > at > org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88) > > > Why am I getting it? this is really annoying... This is expected. Your page submit is including the id of a server-side view state that no longer exists - what should the server do in this case? No "postback" processing can occur when the view cannot be restored, as there are no JSF input or command components to look for data in the submitted form. You can use the element in the web.xml to cause a redirect to the login page (or some other page). The original url and thrown exception (and its causes) are available as request-scoped objects I think. Or use a filter to catch the ViewExpiredException and do whatever you want in this case. Or put some javascript in the login page that "pings" the server every few minutes, so the session does not expire. Or avoid using JSF for the login page. You'll still have this issue on other pages, but it is more understandable to the user that they have "timed out" on some page in the middle of the app rather than having "timed out" in the login page. Regards, Simon -- -- Emails in "mixed" posting style will be ignored -- (http://en.wikipedia.org/wiki/Posting_style)
Re: [JSF][CORE] No View State Exception
ViewExpiredException is thrown on time out. Catch it via web.xml -M On Tue, Feb 17, 2009 at 9:58 AM, Guy Bashan wrote: > I am having a weird issue with JSF: I set the session expiration in my > application to 1 minute (for testing purposes). I load the web application. > the entrance page is a simple login page with 2 fields (username/password). > I wait for 1 minute for session to expire. I try to login. I get this > exception: > > 2009-02-17 10:48:33,522 [http-8080-2] ERROR > org.ajax4jsf.webapp.BaseXMLFilter - Exception in the filter chain > > javax.servlet.ServletException: /login.jspxNo saved view state could be > found for the view identifier: /login.jspx > > at > javax.faces.webapp._ErrorPageWriter.throwException(_ErrorPageWriter.java:546) > > at > javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:266) > > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:160) > > 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:390) > > at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > com.todacell.ui.view.filter.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:100) > > at > com.todacell.ui.view.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:61) > > 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:433) > > 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 com.jamonapi.http.JAMonTomcatValve.invoke(JAMonTomcatValve.java:72) > > 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: /login.jspxNo saved > view state could be found for the view identifier: /login.jspx > > 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:151) > > ... 27 more > > Why am I getting it? this is really annoying... > > Guy. > -- Matthias Wessendorf blog: http://matthiaswessendorf.wordpress.com/ sessions: http://www.slideshare.net/mwessendorf twitter: http://twitter.com/mwessendorf
[JSF][CORE] No View State Exception
I am having a weird issue with JSF: I set the session expiration in my application to 1 minute (for testing purposes). I load the web application. the entrance page is a simple login page with 2 fields (username/password). I wait for 1 minute for session to expire. I try to login. I get this exception: 2009-02-17 10:48:33,522 [http-8080-2] ERROR org.ajax4jsf.webapp.BaseXMLFilter - Exception in the filter chain javax.servlet.ServletException: /login.jspxNo saved view state could be found for the view identifier: /login.jspx at javax.faces.webapp._ErrorPageWriter.throwException(_ErrorPageWriter.java:546) at javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:266) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:160) 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:390) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:301) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.todacell.ui.view.filter.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:100) at com.todacell.ui.view.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:61) 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:433) 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 com.jamonapi.http.JAMonTomcatValve.invoke(JAMonTomcatValve.java:72) 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: /login.jspxNo saved view state could be found for the view identifier: /login.jspx 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:151) ... 27 more Why am I getting it? this is really annoying... Guy.