I've seen many posts for this similar case but I believe my issue may be different. I have figured out the cause but have not yet figured out how to fix it. I am running a 3 liberty servers in CICS in three different regions, all using the same bundle to launch the web application. The web application is fully operational and functions fine, but when all three servers are up and running in the three different regions, the application gets the ViewExpiredException. I have proven that this is why the issue occurs by shutting down two of the servers and attempting to replicate the issue with no success.
In regard to my code, I can post any if needed. As I said, the application is 100 percent operational, but only when one server is using it. All of my method classes are session scoped, except for my database operations class, which is application scoped. I believe workload management causes the current session to occasionally jump between servers, and doing so causes the error. If anyone knows how to fix this I will be very grateful. Thanks so much!
EDIT: I am posting the stack trace.
Caused by: javax.faces.application.ViewExpiredException: /main.xhtml - No saved view state could be found for the view identifier: /main.xhtml
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:183)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:196)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:743)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:440)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1156)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1004)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:76)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:921)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:281)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:960)
at com.ibm.cics.wlp.impl.CICSHttpRunnable.run(CICSHttpRunnable.java:244)
at com.ibm.cics.wlp.impl.CICSTaskWrapper.runWork(CICSTaskWrapper.java:701)
at com.ibm.cics.wlp.impl.CICSTaskWrapper.run(CICSTaskWrapper.java:386)
I think I may have found a solution. This issue may be due to the state saving method being set to server. I have added this to the web.xml of my code:
To my understanding, since the application is jumping between servers, the exception occurs because the state saving method was server side, so it is lost when we travel to another server. Changing the method to client may resolve this issue.
I am currently attempting to replicate the issue. If I am unable to do so, I will select this as the solution.