myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jojada Tirtowidjojo <>
Subject Re: ViewExpiredException: No saved view state could be found for the view identifier
Date Tue, 24 Nov 2015 03:53:50 GMT
Just giving more info.

The ViewExpiredException is caused by the missing SerializedViewCollection
object in the session as the code execution reaches line 338 of
the ServerSideStateCacheImpl class

    protected Object getSerializedViewFromServletSession(FacesContext
context, String viewId, Object sequence)
        ExternalContext externalContext = context.getExternalContext();
        Map<Object, Object> attributeMap = context.getAttributes();
        Object serializedView = null;
        if (attributeMap.containsKey(RESTORED_SERIALIZED_VIEW_REQUEST_ATTR))
            serializedView =
338:     SerializedViewCollection viewCollection =
(SerializedViewCollection) externalContext
            if (viewCollection != null)
                if (sequence != null)
                    Object state = viewCollection.get(

                            context, viewId, sequence));
                    if (state != null)
                        serializedView = deserializeView(state);

Could this possibly be caused by the cookie session setting that isn't
working correctly ?

The cookie setting in my web.xml is:

When I first visit the login page, the Http Response Headers from the
server is

   1. HTTP/1.1 200 OK Date: Tue, 24 Nov 2015 02:24:22 GMT Set-Cookie:
   Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type:
   text/html;charset=utf-8 Transfer-Encoding: chunked Server:

I can see the 'Set-Cookie' header is set by the server.
However, when I submit the login form, the Http Request Headers from the
client is:

   1. POST /TeraTextRS/pages/ HTTP/1.1 Host: localhost:7620
   Connection: keep-alive Content-Length: 157 Cache-Control: max-age=0 Accept:
   Origin: http://localhost:7620 Upgrade-Insecure-Requests: 1 User-Agent:
   Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like
   Gecko) Chrome/46.0.2490.86 Safari/537.36 Content-Type:
   application/x-www-form-urlencoded DNT: 1 Referer:
   <http://localhost:7620/TeraTextRS/pages/login.rsAccept-Encoding>: gzip,
   deflate Accept-Language: en-US,en;q=0.8

There isn't 'Cookie' header in the request.
The client is Chrome and I have already set its Cookies setting to 'Allow
local data to be set'.

The fact that the request header does not have 'Cookie' header set has
bothered me.

Your help is very much appreciated.


On Tue, Nov 24, 2015 at 2:33 PM, Jojada Tirtowidjojo <>

> Hi All,
> I am new to JSF and Myfaces and need answers or pointers that can help me
> fix the problem I am currently having. Would you please help ?
> My application embeds a Jetty 9.3.6 server and uses the Apache MyFaces
> 2.2.8. It runs well with the Jetty default session tracking modes: URL and
> COOKIE but a problem arises when I change the tracking mode to 'COOKIE'
> only. As soon as I submit login details from the login page I receive the
> following exception:
> javax.faces.application.ViewExpiredException: /pages/ - No saved view state could
be found for the view identifier: /pages/
> 	at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(
> 	at javax.faces.webapp.FacesServlet.service(
> 	at org.eclipse.jetty.servlet.ServletHolder.handle(
> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
> 	at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(
> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
> 	at
> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(
> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(
> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(
> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(
> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
> 	at org.eclipse.jetty.server.handler.HandlerCollection.handle(
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
> 	at org.eclipse.jetty.server.Server.handle(
> 	at org.eclipse.jetty.server.HttpChannel.handle(
> 	at org.eclipse.jetty.server.HttpConnection.onFillable(
> 	at$ReadCallback.succeeded(
> 	at
> 	at$
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(
> 	at
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$
> 	at
> Tracing the Myfaces code suggests that the previously saved
> SerializedViewCollection object in the servlet session, somehow, has gone
> missing during an attempt to restore the login view.
> Any comment, answer, and/or pointer is very much appreciated.
> Cheers,

View raw message