1

We are Using SUN JSF 1.2, WebSphere 7.0 for our application, we are getting ViewExpiredException only during the load testing

I have gone through the below link

javax.faces.application.ViewExpiredException: View could not be restored

Have followed most of the stuff,

  1. Setting the context param,

    com.sun.faces.enableRestoreView11Compatibility true

  2. Instructed the browser to not cache the dynamic JSF pages by adding the below code at top of all JSP pages,

        res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); 
        res.setHeader("Pragma", "no-cache");
        res.setDateHeader("Expires", -1); 
    

We are not getting the exception when we manually browse through the application. I am not able to figure out the issue.

Kindly advice.

Community
  • 1
  • 1
Hariharbalaji
  • 2,498
  • 8
  • 36
  • 51

1 Answers1

2

The views are stored in the session. The default maximum amount of views which is stored in the session is 15 which is in Mojarra configureable by the com.sun.faces.numberOfViewsInSession context paramerer.

Imagine a situation wherein the enduser opens a random JSF page with a form (which is effectively one view) in at least 16 different browser tabs/windows in the same session. Submitting the form in the first opened tab/window will then throw ViewExpiredException. Perhaps the same is happening during load testing. The load testing should better have created different sessions.

As stated in the answer which you found yourself, the only fix for this is to set the JSF state saving method to client instead of server. Disabling the browser cache just prevents ViewExpiredException which occurs on pages which the enduser has obtained from the browser cache (e.g. by pressing back button and so on).

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • But BalusC, as a performance tuning the in most of the links it mentioned to have server side saving is good as compared to the Client side saving. So have to consider that as well. – Hariharbalaji Jul 31 '12 at 11:42
  • I have nowhere said that client side state saving is faster than server side state saving. I have only said that the only fix to the particular `ViewExpiredException` is to use client side state saving. Whether to use it or not is up to you. – BalusC Jul 31 '12 at 11:46
  • Sorry! for the confusion, I didn't intent to say that you had told client side state saving is faster than server side state saving. I was just asking a suggestion. Thanks – Hariharbalaji Jul 31 '12 at 12:04