Search code examples
jsf-2session-timeoutviewexpiredexception

Difference between Session Expired and ViewExpiredException


I've come across many solutions for the two 'huge' problems

  • Session Expired
  • ViewExpiredException

My Question: What is the difference between them?

I'm using WAS and I observed

  • Restarting the EAR in the console does not cause the session to expire
  • If there is a current ajax request and the EAR is restarted it throws ViewExpiredException but does not logout the user
  • If the page is idle for, say 30 min, the login screen appears (I've used a sessiontimeoutfilter to handle this)

So isnt ViewExpiredException same as Session Expiry? Also why doesnt restarting the EAR cause the session to expire?

Any help would be appreciated.


Solution

  • Setting javax.faces.STATE_SAVING_METHOD to client will solve the problem. Also using an ExceptionHandler and NoCacheFilter will solved the problem

    I prefered the latter, since it is more maintainable.

    See