Hariharbalaji
Hariharbalaji

Reputation: 2588

javax.faces.application.ViewExpiredException: During load test

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.

Upvotes: 1

Views: 1499

Answers (1)

BalusC
BalusC

Reputation: 1109685

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).

Upvotes: 2

Related Questions