13
votes

All day I try to run JMeter tests of my JSF application. I am aware of ViewState, but it seemed to be quite simple issue. I prepared Regular Expression Extractor:

Reference Name: jsfViewState
Regular expression: id=\"javax.faces.ViewState\" value=\"(.+?)\"
Template $1$
Match No. 1

Regular Exp Extractor

The following samplers are created with proxy and recording.

First request /TourJSF/pages/protected/admin/addTourPage.xhtml. This is GET request from which ViewState will be extracted.

First GET

The POST request /TourJSF/pages/protected/admin/addTourPage.xhtml where .${jsfViewStete} is passed into javax.faces.ViewState

jsfViewState passed

The second GET request, now very important in this case.

Second GET

The results:

First GET. On the right we can see value of ViewState.

first GET result

Debug Sampler which shows that jsfViewState value is correct. We can compare it with the previous screen.

Debug Sampler

javax.faces.application.ViewExpiredException: viewId:/pages/protected/admin/addTourPage.xhtml - View /pages/protected/admin/addTourPage.xhtml could not be restored.

ViewExpiredException addTourPage.xhtml could not be restored

I found some blogs and topics about this issue but many of them were unsolved. If it is needed I can put links to these topics. I am really confused...

Where is the issue? Maybe something with

  • jsessionid?
  • HTTP Header Manager in every HTTP Request? I deleted HTTP Header Manager but nothing changed.
  • something with JSF apllication? When I added context-param com.sun.faces.enableRestoreView11Compatibility into web.xml, there was no ViewExpiredException but the content of returned page was not correct.
1

1 Answers