0

I'm getting serverError-javax.faces.application.ViewExpiredException in Websphere Dev environment on JSF page using Ajax but not getting in my local environment. The Code is same in both environments. I used IDE for building in my local and I used Maven in Dev. JSF 2.0, WAS 8.5. What could be causing it.

I've looked at similar posts and have implemented various suggestions like making managed bean implement serialized interface etc but no luck. As code is same in both environments could it be related to maven build?

org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION is 20 (default).

I'm supposed to get error message on a field if validation fails but instead it's giving the view expired exception:

<h:inputText styleClass="inputs" id="assessmentStation" size="3" 
        maxlength="3"                                                                                                    
         required="true" requiredMessage="Assessment Station must be entered"
      <p:ajax event="blur" update="assessmentStationMsg"></p:ajax>
</h:inputText>
user5857902
  • 55
  • 1
  • 1
  • 8
  • What are the steps to reproduce? – Vsevolod Golovanov Jun 03 '18 at 09:45
  • I'm supposed to get error message on a field if validation fails but instead it's giving the view expired exception: – user5857902 Jun 03 '18 at 11:19
  • So you don't get this when using an `f:ajax` instead of a `p:ajax`? – Kukeltje Jun 03 '18 at 19:04
  • f:ajax is causing error messages to display in console on my local VM. And after deployment on Dev server both p: and f: are causing this exception. So, I need to use p:ajax because atleast it's fine on my local. What could be causing this exception? The only difference is I'm using maven to build for dev server but using IDE in my local VM. – user5857902 Jun 03 '18 at 19:49
  • When I use f:ajax I get below in console on my local VM There are some unhandled FacesMessages, this means not every FacesMessage had a chance to be rendered. These unhandled FacesMessages are: - Assessment Station must be entered – user5857902 Jun 03 '18 at 20:23
  • I've tried using the same EAR from Dev server on my local VM and it's displaying messages. I think it's related to environment. What environment configuration could cause this exception? – user5857902 Jun 03 '18 at 20:42
  • bad session management? And JSF 2.0 is OLD... and read all in https://stackoverflow.com/questions/3642919/javax-faces-application-viewexpiredexception-view-could-not-be-restored or https://myfaces.apache.org/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/viewexpiredexception-and-session-expiry.html (after some simple google search) – Kukeltje Jun 04 '18 at 19:57
  • I had read these posts but I don't get why my session will timeout, timeout is set to 20 mins. However, I'll go thru the posts once again and also use latest version of JSF. – user5857902 Jun 04 '18 at 20:17
  • I'm not doing logout and log back in. Just doing AJAX post. – user5857902 Jun 04 '18 at 20:42
  • @Kukeltje These posts did not help much. The session is still active. What could be other reason? – user5857902 Jun 06 '18 at 13:47
  • @BalusC - do you have any suggestions? – user5857902 Jun 06 '18 at 13:49
  • increase the debuglevel of you JSF impl and try to find out. I personally never ran into issues that were not related to the number of views or the session cookie – Kukeltje Jun 06 '18 at 14:05
  • Thnaks Kuketji, will try that! – user5857902 Jun 06 '18 at 14:40
  • The issues is resolved by two methods: 1. Changing STATE_SAVING_METHOD to client resolved the issue. 2. There was no session cookie being returned to the browser. We changed to use https and the cookie is being returned and the application is now displaying error messages. We will go with 2 :) – user5857902 Jun 06 '18 at 15:40

1 Answers1

0

The issues is resolved by two methods: 1. Changing STATE_SAVING_METHOD to client resolved the issue. 2. There was no session cookie being returned to the browser. We changed to use https and the cookie is being returned and the application is now displaying error messages. We will go with 2 :)

user5857902
  • 55
  • 1
  • 1
  • 8