JSF 1.2 exception during view restoration with expired session

3.9k views Asked by At

We migrated to WebSphere 7.0 from 6.1 recently and also upgraded from JSF1.1 to JSF1.2. Everytime the session expires and anything is submitted through the browser i now get an exception:

Caused by: javax.faces.application.ViewExpiredException: viewId:/Foo/Bar.jsp - View /Foo/Bar.jsp could not be restored.

How can i prevent that error?

  • The results of a request are rendered on the same page as the input fields.
  • I am using a session scoped backing bean for the page.

Edit: It does look like a WAS 7.0/JSF 1.2 migration issue see https://www.ibm.com/developerworks/forums/thread.jspa?threadID=332460&tstart=30 (no answer provided)

BalusC explains here why it happens javax.faces.application.ViewExpiredException: View could not be restored . But why did it not happen before? Several apps were working fine before the migration.

2

There are 2 answers

1
Steven De Groote On BEST ANSWER

Have you checked this? Handling 'session expired' in JSF web application, running in JBoss AS 5

At least that is how I'm handling session expiration in my JSF application.

Hope it helps Steven

0
Arjan Tijms On

This is not new for JSF 1.2 and also has little to do with Websphere.

My guess is that you previously had state stored on the client, and thus never encountered this exception before. The default in JSF is to save the state on the server. You can explicitly ask for state on the client by putting the following in web.xml:

<context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
</context-param>

See this question for a more elaborate answer: Why JSF saves the state of UI components on server?