You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2013/10/01 07:13:51 UTC

Re: Random JSF error: no saved view state could be found

Hi

Do you run mojarra on tomee? Basically the exception you sent doesnt seem
complete and is not usable to help.

About "it works with mojarra so that's mf" it is a big shortcut. It can be
a bug in mojarra which make it working too (im not saying it, just you dont
know and you cant conclude since you were not able to give us any info on
this issue we can use to work on it)

In all cases of you handle to reproduce please share the whole logs and
maybe your server settings. Tomee can be the cause too depending it.
Le 30 sept. 2013 23:33, "Zmirc" <zm...@gmail.com> a écrit :

> Hi, Leonardo!
>
> Unfortunately, I've been very pressed by having to get it to work in
> production, so I switched this project to Majorra. Happily enough, the
> error didn't appear anymore, at least until now.
>
> I would have definitely loved to afford doing those tests, but it wasn't
> possible unfortunately.
> Anyway, by the fact that now it doesn't appear just by changin to Majorra,
> it is obvious that there might be a hidden little bug somewhere in MyFaces,
> otherwise it can't be explained.
>
> I'm so sorry that I can't reproduce it. It happened completely random. It
> might be as you suggested, a problem in creating/reloading the state. You
> know better than me those details.
>
> I would really like to have that bug discovered and fixed, because I was
> quite used to MyFaces.
> Thank you again for trying to help.
> I hope something can be done about it. I know that, without being able to
> reproduce it, it's a little bit hard, but I hope.
>
> Best,
> Mircea
>
> On 9/27/2013 11:56 AM, Leonardo Uribe wrote:
>
>> Hi
>>
>> There is no magical solutions to you problem. You should check which value
>> has javax.faces.ViewState request parameter in the POST request that
>> causes
>> the ViewExpiredException. Put a filter or a PhaseListener that logs that
>> value when there is an incoming request to that view. The key point is to
>> know if the view state token is there or not and if it has been altered
>> somehow between the time the page is renderer and the time the button is
>> clicked and the POST is sended. You need to log the token saved on the
>> page
>> too, to know the original value.
>>
>> One option I can imagine is that the value in the ViewState token is sent
>> partially. The server received the trimmed token, it doesn't match because
>> it is broken and it throws correctly the ViewExpiredException. But sounds
>> unlikely, we need more evidence about what's going on.
>>
>> What I can say is the code in MyFaces Core is ok in that part and
>> specifically the state management code has been tested exhaustively. It is
>> quite unlikely to find a bug in that part.
>>
>> regards,
>>
>> Leonardo Uribe
>>
>>
>>
>> 2013/9/27 Zmirc <zm...@gmail.com>
>>
>>  Hi again!
>>>
>>> Any ideas / fixes for this bug?
>>> It's still there and is completely random.
>>> Moreover, I can't reproduce it.
>>>
>>> Please don't ignore it, because it's a real pain in the ...
>>> It's screwing up the whole project, because some users get this bug
>>> randomly, whenever they execute a post (command button).
>>>
>>> Thank you so so much in advance.
>>>
>>>
>>> On 9/25/2013 12:17 PM, Zmirc wrote:
>>>
>>>  Hi!
>>>> Some users (few) of the app I work on experience a very strange error,
>>>> which I can't yet reproduce.
>>>> Moreover, it appears in less than 10~ of executions.
>>>>
>>>> Error: No saved view state could be found for the view identifier:
>>>> /mypage.xhtml
>>>>
>>>> Application server: Apache Tomee 1.5.2 stable / 1.6.0-2013.09.20 dev (It
>>>> happens on both). I use the MyFaces distribution that comes with each of
>>>> them, so 2.1.10 / 2.1.12, so nothing new added.
>>>>
>>>> Part of web.xml
>>>> |<context-param>
>>>>           <param-name>org.apache.****myfaces.USE_ENCRYPTION</param-**
>>>> **name>
>>>>           <param-value>false</param-****value>
>>>>         </context-param>
>>>>         <context-param>
>>>>           <param-name>javax.faces.STATE_****SAVING_METHOD</param-name>
>>>>           <param-value>client</param-****value>
>>>>         </context-param>|
>>>>
>>>> So, no state view exception shouldn't happen, because state is on
>>>> client.
>>>> It was set on server before, but I thought maybe client will fix it, but
>>>> nothing. There was actually no difference in the occurrence of that
>>>> error.
>>>> Moreover, it's not related to deploy/redeploy/restart, because
>>>> encryption
>>>> is false. I don't experience any problem with that.
>>>>
>>>> Execution flow:
>>>> 1. Client opens xhtml page (JSF).
>>>> 2. Client clicks on an command button to do various things, button
>>>> connected to a public void method of a JSF @ViewScoped ManagedBean.
>>>> 3. Yes, the method is void because I don't need to return a String to
>>>> redirect to another page. I need to redirect to /page/id (example:
>>>> /market/24, /profile/43), therefore methods that return a String as
>>>> navigation destinations are useless, because I use:|FacesContext.**
>>>> getCurrentInstance().****getExternalContext().redirect(****path);|
>>>> 4. In ~90% of the cases, everything works perfectly and users are
>>>> redirected to each specific page. In the rest of ~10 (randomly), they
>>>> get|No saved view state could be found for the view identifier:
>>>> /pagename.xhtml
>>>> |Basically, the command button's method is not executed.
>>>>
>>>> I would really appreciate some help here, because I have no idea how to
>>>> get it fixed.
>>>> Thanks a lot in advance.
>>>>
>>>> /*Session timeout is set to 30 days in web.xml (302400). The error
>>>> happens at random times for random users, but all users didn't use the
>>>> system yet for 30 days, so it's a little bit strange.*/
>>>>
>>>> I use PrimeFaces and I also have a couple of my own filters in web.xml,
>>>> but that shouldn't be a problem, I hope so.
>>>>
>>>> Any ideas please? I really don't know what to do in order to fix it.
>>>> Thanks a lot in advance.
>>>> It's on StackOverflow also: http://stackoverflow.com/**
>>>> questions/18992241/random-jsf-****error-no-saved-view-state-**
>>>> could-be-found/18999855<http:/**/stackoverflow.com/questions/**
>>>> 18992241/random-jsf-error-no-**saved-view-state-could-be-**
>>>> found/18999855<http://stackoverflow.com/questions/18992241/random-jsf-error-no-saved-view-state-could-be-found/18999855>
>>>> >
>>>>
>>>> Stack trace for one of the pages:
>>>>
>>>> |25-Sep-2013  07:39:26.380  SEVERE[http-bio-80-exec-15]
>>>>   org.apache.catalina.core.****StandardWrapperValve.invoke
>>>>    Servlet.service()
>>>>    for  servlet[Faces  Servlet]  in  contextwith  path[]  threw
>>>> exception[/dashboard/edit-****profile.xhtmlNo saved view state could be
>>>> foundfor  the view identifier:  /dashboard/edit-profile.xhtml]  with
>>>>  root
>>>> cause
>>>>    javax.faces.application.****ViewExpiredException:
>>>>   /dashboard/edit-profile.****xhtmlNo saved view state could be
>>>> foundfor
>>>>   the view identifier:  /dashboard/edit-profile.xhtml
>>>>           at org.apache.myfaces
>>>> .lifecycle.RestoreViewExe
>>>> cutor.execute(RestoreView
>>>> Executor.java:132)
>>>>           at org.apache.myfaces
>>>> .lifecycle.LifecycleImpl<
>>>> /span>.executePhase(****LifecycleImp
>>>> l.java:170)
>>>>           at org.apache.myfaces
>>>> .lifecycle.LifecycleImpl<
>>>> /span>.execute(LifecycleImpl.****java:117)
>>>>           at javax.faces.webapp
>>>> .FacesServlet.service(****FacesServlet.java:197)
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.internalDoFilter(App
>>>> licationFilterChain.java:305
>>>> )
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.doFilter(Application
>>>> FilterChain.java:210<
>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>> transparent;
>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>> background-repeat: initial initial;">)
>>>>           at org.primefaces.web
>>>> app.filter.FileUploadFilt
>>>> er.doFilter(FileUploadFil
>>>> ter.java:77)
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.internalDoFilter(App
>>>> licationFilterChain.java:243
>>>> )
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.doFilter(Application
>>>> FilterChain.java:210<
>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>> transparent;
>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>> background-repeat: initial initial;">)
>>>>           at org.ocpsoft.rewrit
>>>> e.servlet.RewriteFilter.****doFilter(RewriteFilter.java:****199)
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.internalDoFilter(App
>>>> licationFilterChain.java:243
>>>> )
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.doFilter(Application
>>>> FilterChain.java:210<
>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>> transparent;
>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>> background-repeat: initial initial;">)
>>>>           at com.pingushare.bou
>>>> ndary.filter.ActivateAcco
>>>> untFilter.doFilter(Activa
>>>> teAccountFilter.java:37)
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.internalDoFilter(App
>>>> licationFilterChain.java:243
>>>> )
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.doFilter(Application
>>>> FilterChain.java:210<
>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>> transparent;
>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>> background-repeat: initial initial;">)
>>>>           at com.pingushare.bou
>>>> ndary.filter.SecurityFilt
>>>> er.doFilter(SecurityFilte
>>>> r.java:36)
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.internalDoFilter(App
>>>> licationFilterChain.java:243
>>>> )
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.doFilter(Application
>>>> FilterChain.java:210<
>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>> transparent;
>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>> background-repeat: initial initial;">)
>>>>           at com.pingushare.bou
>>>> ndary.filter.ForceFreshPa
>>>> geAndWWWFilter.doFilter(F
>>>> orceFreshPageAndWWWFilter.****java:49)
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.internalDoFilter(App
>>>> licationFilterChain.java:243
>>>> )
>>>>           at org.apache.catalin
>>>> a.core.ApplicationFilterC
>>>> hain.doFilter(Application
>>>> FilterChain.java:210<
>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>> transparent;
>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>> background-repeat: initial initial;">)
>>>>           at org.apache.catalin
>>>> a.core.StandardWrapperVal
>>>> ve.invoke(StandardWrapper
>>>> Valve.java:222)
>>>>           at org.apache.catalin
>>>> a.core.StandardContextVal
>>>> ve.invoke(StandardContext
>>>>
>>>> Valve.java:123)
>>>>           at org.apache.tomee.catalina.****OpenEJBValve.invoke(**
>>>> OpenEJBValve.java:45)
>>>>           at org.apache.catalin
>>>> a.authenticator.Authentic
>>>> atorBase.invoke(Authentic
>>>> atorBase.java:502)
>>>>           at org.apache.catalin
>>>> a.core.StandardHostValve<
>>>> /span>.invoke(****StandardHostValve<
>>>> /span>.java:171)
>>>>           at org.apache.catalin
>>>> a.valves.ErrorReportValve
>>>> .invoke(ErrorReportValve<
>>>> /span>.java:99)
>>>>           at org.apache.catalin
>>>> a.valves.AccessLogValve.****invoke(AccessLogValve.java:****953)
>>>>           at org.apache.catalin
>>>> a.core.StandardEngineValv
>>>> e.invoke(StandardEngineVa
>>>> lve.java:118)
>>>>           at org.apache.catalin
>>>> a.connector.CoyoteAdapter
>>>> .service(CoyoteAdapter.java:****408)
>>>>           at org.apache.coyote<
>>>> /span>.http11.****AbstractHttp11Proc
>>>> essor.process(AbstractHtt
>>>> p11Processor.java:1023)
>>>>           at org.apache.coyote<
>>>> /span>.AbstractProtocol$****AbstractConnectionHandler.**
>>>> process(AbstractProtocol.java:****589)
>>>>           at org.apache.tomcat<
>>>> /span>.util.net.JIoEndpoint$****SocketProcessor.run(****
>>>> JIoEndpoint.java:312)
>>>>           at java.util.concurre
>>>> nt.ThreadPoolExecutor.run
>>>> Worker(ThreadPoolExecutor.****java:1145)
>>>>           at java.util.concurre
>>>> nt.ThreadPoolExecutor$Worker.****run(ThreadPoolExecutor.java:****615)
>>>>           at java.lang.Thr
>>>> ead.run(Thread.java:724)|
>>>>
>>>>
>>>
>

Re: Random JSF error: no saved view state could be found

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
response inline/below...

On Tue, Oct 1, 2013 at 1:13 AM, Romain Manni-Bucau <rm...@gmail.com>wrote:

> About "it works with mojarra so that's mf" it is a big shortcut. It can be
> a bug in mojarra which make it working too (im not saying it, just you dont
> know and you cant conclude since you were not able to give us any info on
> this issue we can use to work on it)
>

I agree with this. when i migrated from mojarra 2.1.7 to myfaces 2.1.8 (in
late year 2012), I found out that mojarra allowed me to get away with many
many things, maybe since I was junior-JSF-developer, and it gave me feeling
that mojarra works well and is recommended for junior-JSF-developers
because it allows your app to 'just work' regardless if your code is
correct or not.

definitely not calling you a junior developer, but when i migrated from
mojarra to myfaces, my experience was...i had to 'fix' a bunch of my code,
because my (junior-JSF-developer) code was not working with myfaces.

will respond more, as i saw some things in your latest post... (my comments
are directed at OP)

Re: Random JSF error: no saved view state could be found

Posted by Leonardo Uribe <lu...@gmail.com>.
Yes, absolutely. These kind of issues are really hard to reproduce, even
more to debug. I'm still thinking it should be something else, but anyway
if we can find what's going on and if the issue is related to myfaces it
will be fixed in no time.
On Oct 1, 2013 10:00 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> Hmm,
>
> can be interesting if you have enough time to try to reproduce it in a
> shareable (on github?) project.
>
> I'm sure it is something "stupid" we don't see ATM.
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<
> http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/10/1 Zmirc <zm...@gmail.com>
>
> > Hi!
> >
> > Yes, I run Majorra on Tomee 1.6.0 from 13.09.20. I will switch today to
> > 13.10.01 to see if that bug with @Schedule leak disappeared.
> >
> > I understand your point of view and I agree. I have no idea which one has
> > the bug, just that I don't get it on Majorra. (I've just deleted myfaces
> > jars from Tomee and added Majorra 2.1.26 - nothing special)
> >
> > What settings should I give you? I didn't modify anything in Tomee,
> > excepting perm gen size, heap (on production) and a few more things in
> > setenv. Here's the setenv on my windows. (It's the same on linux also,
> just
> > as .sh)
> >
> > set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=512m
> > set JAVA_OPTS=%JAVA_OPTS% -Dorg.apache.catalina.session.**
> > StandardSession.ACTIVITY_**CHECK=true
> > set JAVA_OPTS=%JAVA_OPTS% -Dopenejb.session-context=http
> > set JAVA_OPTS=%JAVA_OPTS% -Dfacebook4j.loggerFactory=**
> > facebook4j.internal.logging.**NullLoggerFactory
> >
> > So...the error happens randomly (just sometimes to some users) for all
> > pages that modify information and are backed by a @ViewScoped bean:
> >
> > The following logs are from Tomee 1.6.0 13.09.20. It happens the same on
> > 1.5.2. I moved on 1.6.0 hoping to get rid of it.
> >
> > javax.servlet.**ServletException: /dashboard/edit-profile.**xhtmlNo saved
> > view state could be found for the view identifier:
> > /dashboard/edit-profile.xhtml
> >     at javax.faces.webapp.**FacesServlet.service(**FacesServlet.java:213)
> > ~[myfaces-api-2.1.12.jar:2.1.**12]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**
> > internalDoFilter(**ApplicationFilterChain.java:**305)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> > ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
> >     at
> org.primefaces.webapp.filter.**FileUploadFilter.doFilter(**FileUploadFilter.java:77)
> > ~[primefaces-3.5.jar:na]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**
> > internalDoFilter(**ApplicationFilterChain.java:**243)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> > ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
> >     at
> org.ocpsoft.rewrite.servlet.**RewriteFilter.doFilter(**RewriteFilter.java:199)
> > ~[rewrite-servlet-2.0.7.Final.**jar:2.0.7.Final]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**
> > internalDoFilter(**ApplicationFilterChain.java:**243)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> > ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
> >     at
> com.pingushare.boundary.**filter.ActivateAccountFilter.**doFilter(*
> > *ActivateAccountFilter.java:38) ~[ActivateAccountFilter.class:**na]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**
> > internalDoFilter(**ApplicationFilterChain.java:**243)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> > ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
> >     at com.pingushare.boundary.**filter.SecurityFilter.**
> > doFilter(SecurityFilter.java:**36) ~[SecurityFilter.class:na]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**
> > internalDoFilter(**ApplicationFilterChain.java:**243)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> > ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
> >     at com.pingushare.boundary.**filter.**ForceFreshPageAndWWWFilter.**
> > doFilter(**ForceFreshPageAndWWWFilter.**java:41)
> > ~[ForceFreshPageAndWWWFilter.**class:na]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**
> > internalDoFilter(**ApplicationFilterChain.java:**243)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> > ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.core.**StandardWrapperValve.invoke(**StandardWrapperValve.java:222)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.core.**StandardContextValve.invoke(**StandardContextValve.java:123)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.tomee.catalina.**OpenEJBValve.invoke(**OpenEJBValve.java:45)
> > ~[tomee-catalina-1.6.0-**SNAPSHOT.jar:1.6.0-SNAPSHOT]
> >     at
> org.apache.catalina.**authenticator.**AuthenticatorBase.invoke(**AuthenticatorBase.java:502)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.core.**StandardHostValve.invoke(**StandardHostValve.java:171)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.valves.**ErrorReportValve.invoke(**ErrorReportValve.java:99)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.valves.**AccessLogValve.invoke(**AccessLogValve.java:953)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.core.**StandardEngineValve.invoke(**StandardEngineValve.java:118)
> > ~[catalina.jar:7.0.42]
> >     at
> org.apache.catalina.connector.**CoyoteAdapter.service(**CoyoteAdapter.java:408)
> > ~[catalina.jar:7.0.42]
> >     at org.apache.coyote.http11.**AbstractHttp11Processor.**process(**
> > AbstractHttp11Processor.java:**1023) ~[tomcat-coyote.jar:7.0.42]
> >     at
> org.apache.coyote.**AbstractProtocol$**AbstractConnectionHandler.**
> > process(AbstractProtocol.java:**589) ~[tomcat-coyote.jar:7.0.42]
> >     at
> org.apache.tomcat.util.net.**JIoEndpoint$SocketProcessor.**run(JIoEndpoint.java:312)
> > ~[tomcat-coyote.jar:7.0.42]
> >     at
> java.util.concurrent.**ThreadPoolExecutor.runWorker(**ThreadPoolExecutor.java:1145)
> > ~[na:1.7.0_25]
> >     at
> java.util.concurrent.**ThreadPoolExecutor$Worker.run(**ThreadPoolExecutor.java:615)
> > ~[na:1.7.0_25]
> >     at java.lang.Thread.run(Thread.**java:724) ~[na:1.7.0_25]
> > Caused by: javax.faces.application.**ViewExpiredException:
> > /dashboard/edit-profile.**xhtmlNo saved view state could be found for the
> > view identifier: /dashboard/edit-profile.xhtml
> >     at
> org.apache.myfaces.lifecycle.**RestoreViewExecutor.execute(**RestoreViewExecutor.java:132)
> > ~[myfaces-impl-2.1.12.jar:2.1.**12]
> >     at
> org.apache.myfaces.lifecycle.**LifecycleImpl.executePhase(**LifecycleImpl.java:170)
> > ~[myfaces-impl-2.1.12.jar:2.1.**12]
> >     at
> org.apache.myfaces.lifecycle.**LifecycleImpl.execute(**LifecycleImpl.java:117)
> > ~[myfaces-impl-2.1.12.jar:2.1.**12]
> >     at javax.faces.webapp.**FacesServlet.service(**FacesServlet.java:197)
> > ~[myfaces-api-2.1.12.jar:2.1.**12]
> >     ... 32 common frames omitted
> >
> > I have attached one of the beans (This is the only one @RequestScoped) +
> > an utility class used for redirecting. (The format might be strange
> because
> > of NetBeans settings probably)
> > The JSF(xhtml) page does just call updateAndRedirect() (redirects to
> > /profile/userId) or just updateProfile() (stays on the same page) when
> user
> > uploads a profile pic also.
> >
> > I've also attached a @ViewScoped bean (JSF calls add() on submit from
> it).
> > It might look like more code, but the basic idea is simple: user goes to
> a
> > page (edit profile, add item, edit item etc.), writes some input then
> > presses Save, then, sometimes/randomly, the no state error is triggered
> and
> > I get the above log from Tomee.
> >
> > It shouldn't be anything with the container session, because users are
> not
> > deauthenticated or any similar things.
> > I have no idea and it's so frustrating that I can't (I don't have) give
> > you more details to reproduce it.
> > I've been personally struggling with it for around 2 weeks, because it
> > took some time until I've figured out that it's not my bug.
> >
> > If something else might be useful/necessary, I'm willing to help.
> > Best wishes!
> > Mircea
> >
> >
> > On 10/1/2013 7:13 AM, Romain Manni-Bucau wrote:
> >
> >> Hi
> >>
> >> Do you run mojarra on tomee? Basically the exception you sent doesnt
> seem
> >> complete and is not usable to help.
> >>
> >> About "it works with mojarra so that's mf" it is a big shortcut. It can
> be
> >> a bug in mojarra which make it working too (im not saying it, just you
> >> dont
> >> know and you cant conclude since you were not able to give us any info
> on
> >> this issue we can use to work on it)
> >>
> >> In all cases of you handle to reproduce please share the whole logs and
> >> maybe your server settings. Tomee can be the cause too depending it.
> >> Le 30 sept. 2013 23:33, "Zmirc" <zm...@gmail.com> a écrit :
> >>
> >>  Hi, Leonardo!
> >>>
> >>> Unfortunately, I've been very pressed by having to get it to work in
> >>> production, so I switched this project to Majorra. Happily enough, the
> >>> error didn't appear anymore, at least until now.
> >>>
> >>> I would have definitely loved to afford doing those tests, but it
> wasn't
> >>> possible unfortunately.
> >>> Anyway, by the fact that now it doesn't appear just by changin to
> >>> Majorra,
> >>> it is obvious that there might be a hidden little bug somewhere in
> >>> MyFaces,
> >>> otherwise it can't be explained.
> >>>
> >>> I'm so sorry that I can't reproduce it. It happened completely random.
> It
> >>> might be as you suggested, a problem in creating/reloading the state.
> You
> >>> know better than me those details.
> >>>
> >>> I would really like to have that bug discovered and fixed, because I
> was
> >>> quite used to MyFaces.
> >>> Thank you again for trying to help.
> >>> I hope something can be done about it. I know that, without being able
> to
> >>> reproduce it, it's a little bit hard, but I hope.
> >>>
> >>> Best,
> >>> Mircea
> >>>
> >>> On 9/27/2013 11:56 AM, Leonardo Uribe wrote:
> >>>
> >>>  Hi
> >>>>
> >>>> There is no magical solutions to you problem. You should check which
> >>>> value
> >>>> has javax.faces.ViewState request parameter in the POST request that
> >>>> causes
> >>>> the ViewExpiredException. Put a filter or a PhaseListener that logs
> that
> >>>> value when there is an incoming request to that view. The key point is
> >>>> to
> >>>> know if the view state token is there or not and if it has been
> altered
> >>>> somehow between the time the page is renderer and the time the button
> is
> >>>> clicked and the POST is sended. You need to log the token saved on the
> >>>> page
> >>>> too, to know the original value.
> >>>>
> >>>> One option I can imagine is that the value in the ViewState token is
> >>>> sent
> >>>> partially. The server received the trimmed token, it doesn't match
> >>>> because
> >>>> it is broken and it throws correctly the ViewExpiredException. But
> >>>> sounds
> >>>> unlikely, we need more evidence about what's going on.
> >>>>
> >>>> What I can say is the code in MyFaces Core is ok in that part and
> >>>> specifically the state management code has been tested exhaustively.
> It
> >>>> is
> >>>> quite unlikely to find a bug in that part.
> >>>>
> >>>> regards,
> >>>>
> >>>> Leonardo Uribe
> >>>>
> >>>>
> >>>>
> >>>> 2013/9/27 Zmirc <zm...@gmail.com>
> >>>>
> >>>>   Hi again!
> >>>>
> >>>>> Any ideas / fixes for this bug?
> >>>>> It's still there and is completely random.
> >>>>> Moreover, I can't reproduce it.
> >>>>>
> >>>>> Please don't ignore it, because it's a real pain in the ...
> >>>>> It's screwing up the whole project, because some users get this bug
> >>>>> randomly, whenever they execute a post (command button).
> >>>>>
> >>>>> Thank you so so much in advance.
> >>>>>
> >>>>>
> >>>>> On 9/25/2013 12:17 PM, Zmirc wrote:
> >>>>>
> >>>>>   Hi!
> >>>>>
> >>>>>> Some users (few) of the app I work on experience a very strange
> error,
> >>>>>> which I can't yet reproduce.
> >>>>>> Moreover, it appears in less than 10~ of executions.
> >>>>>>
> >>>>>> Error: No saved view state could be found for the view identifier:
> >>>>>> /mypage.xhtml
> >>>>>>
> >>>>>> Application server: Apache Tomee 1.5.2 stable / 1.6.0-2013.09.20 dev
> >>>>>> (It
> >>>>>> happens on both). I use the MyFaces distribution that comes with
> each
> >>>>>> of
> >>>>>> them, so 2.1.10 / 2.1.12, so nothing new added.
> >>>>>>
> >>>>>> Part of web.xml
> >>>>>> |<context-param>
> >>>>>>            <param-name>org.apache.******
> >>>>>> myfaces.USE_ENCRYPTION</param-****
> >>>>>> **name>
> >>>>>>            <param-value>false</param-******value>
> >>>>>>          </context-param>
> >>>>>>          <context-param>
> >>>>>>            <param-name>javax.faces.STATE_**
> >>>>>> ****SAVING_METHOD</param-name>
> >>>>>>            <param-value>client</param-******value>
> >>>>>>
> >>>>>>          </context-param>|
> >>>>>>
> >>>>>> So, no state view exception shouldn't happen, because state is on
> >>>>>> client.
> >>>>>> It was set on server before, but I thought maybe client will fix it,
> >>>>>> but
> >>>>>> nothing. There was actually no difference in the occurrence of that
> >>>>>> error.
> >>>>>> Moreover, it's not related to deploy/redeploy/restart, because
> >>>>>> encryption
> >>>>>> is false. I don't experience any problem with that.
> >>>>>>
> >>>>>> Execution flow:
> >>>>>> 1. Client opens xhtml page (JSF).
> >>>>>> 2. Client clicks on an command button to do various things, button
> >>>>>> connected to a public void method of a JSF @ViewScoped ManagedBean.
> >>>>>> 3. Yes, the method is void because I don't need to return a String
> to
> >>>>>> redirect to another page. I need to redirect to /page/id (example:
> >>>>>> /market/24, /profile/43), therefore methods that return a String as
> >>>>>> navigation destinations are useless, because I use:|FacesContext.**
> >>>>>> getCurrentInstance().******getExternalContext().redirect(**
> >>>>>> ****path);|
> >>>>>>
> >>>>>> 4. In ~90% of the cases, everything works perfectly and users are
> >>>>>> redirected to each specific page. In the rest of ~10 (randomly),
> they
> >>>>>> get|No saved view state could be found for the view identifier:
> >>>>>> /pagename.xhtml
> >>>>>> |Basically, the command button's method is not executed.
> >>>>>>
> >>>>>> I would really appreciate some help here, because I have no idea how
> >>>>>> to
> >>>>>> get it fixed.
> >>>>>> Thanks a lot in advance.
> >>>>>>
> >>>>>> /*Session timeout is set to 30 days in web.xml (302400). The error
> >>>>>> happens at random times for random users, but all users didn't use
> the
> >>>>>> system yet for 30 days, so it's a little bit strange.*/
> >>>>>>
> >>>>>> I use PrimeFaces and I also have a couple of my own filters in
> >>>>>> web.xml,
> >>>>>> but that shouldn't be a problem, I hope so.
> >>>>>>
> >>>>>> Any ideas please? I really don't know what to do in order to fix it.
> >>>>>> Thanks a lot in advance.
> >>>>>> It's on StackOverflow also: http://stackoverflow.com/**
> >>>>>> questions/18992241/random-jsf-******error-no-saved-view-state-****
> >>>>>> could-be-found/18999855<http:/****/stackoverflow.com/**questions/**
> <http://stackoverflow.com/questions/**>
> >>>>>> 18992241/random-jsf-error-no-****saved-view-state-could-be-**
> >>>>>>
> >>>>>> found/18999855<http://**stackoverflow.com/questions/**
> >>>>>> 18992241/random-jsf-error-no-**saved-view-state-could-be-**
> >>>>>> found/18999855<
> http://stackoverflow.com/questions/18992241/random-jsf-error-no-saved-view-state-could-be-found/18999855
> >
> >>>>>> >
> >>>>>> Stack trace for one of the pages:
> >>>>>>
> >>>>>> |25-Sep-2013  07:39:26.380  SEVERE[http-bio-80-exec-15]
> >>>>>>    org.apache.catalina.core.******StandardWrapperValve.invoke
> >>>>>>
> >>>>>>     Servlet.service()
> >>>>>>     for  servlet[Faces  Servlet]  in  contextwith  path[]  threw
> >>>>>> exception[/dashboard/edit-******profile.xhtmlNo saved view state
> >>>>>> could be
> >>>>>>
> >>>>>> foundfor  the view identifier:  /dashboard/edit-profile.xhtml]  with
> >>>>>>   root
> >>>>>> cause
> >>>>>>     javax.faces.application.******ViewExpiredException:
> >>>>>>    /dashboard/edit-profile.******xhtmlNo saved view state could be
> >>>>>>
> >>>>>> foundfor
> >>>>>>    the view identifier:  /dashboard/edit-profile.xhtml
> >>>>>>            at org.apache.myfaces
> >>>>>> .lifecycle.RestoreViewExe
> >>>>>> cutor.execute(RestoreView
> >>>>>> Executor.java:132)
> >>>>>>            at org.apache.myfaces
> >>>>>> .lifecycle.LifecycleImpl<
> >>>>>> /span>.executePhase(******LifecycleImp
> >>>>>>
> >>>>>> l.java:170)
> >>>>>>            at org.apache.myfaces
> >>>>>> .lifecycle.LifecycleImpl<
> >>>>>> /span>.execute(LifecycleImpl.******java:117)
> >>>>>>            at javax.faces.webapp
> >>>>>> .FacesServlet.service(******FacesServlet.java:197)
> >>>>>>
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.internalDoFilter(App
> >>>>>> licationFilterChain.java:305
> >>>>>> )
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.doFilter(Application
> >>>>>> FilterChain.java:210<
> >>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
> >>>>>> font-size: 14px; vertical-align: baseline; background-color:
> >>>>>> transparent;
> >>>>>> color: rgb(0, 0, 0); background-position: initial initial;
> >>>>>> background-repeat: initial initial;">)
> >>>>>>            at org.primefaces.web
> >>>>>> app.filter.FileUploadFilt
> >>>>>> er.doFilter(FileUploadFil
> >>>>>> ter.java:77)
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.internalDoFilter(App
> >>>>>> licationFilterChain.java:243
> >>>>>> )
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.doFilter(Application
> >>>>>> FilterChain.java:210<
> >>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
> >>>>>> font-size: 14px; vertical-align: baseline; background-color:
> >>>>>> transparent;
> >>>>>> color: rgb(0, 0, 0); background-position: initial initial;
> >>>>>> background-repeat: initial initial;">)
> >>>>>>            at org.ocpsoft.rewrit
> >>>>>> e.servlet.RewriteFilter.******doFilter(RewriteFilter.java:******199)
> >>>>>>
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.internalDoFilter(App
> >>>>>> licationFilterChain.java:243
> >>>>>> )
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.doFilter(Application
> >>>>>> FilterChain.java:210<
> >>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
> >>>>>> font-size: 14px; vertical-align: baseline; background-color:
> >>>>>> transparent;
> >>>>>> color: rgb(0, 0, 0); background-position: initial initial;
> >>>>>> background-repeat: initial initial;">)
> >>>>>>            at com.pingushare.bou
> >>>>>> ndary.filter.ActivateAcco
> >>>>>> untFilter.doFilter(Activa
> >>>>>> teAccountFilter.java:37)
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.internalDoFilter(App
> >>>>>> licationFilterChain.java:243
> >>>>>> )
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.doFilter(Application
> >>>>>> FilterChain.java:210<
> >>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
> >>>>>> font-size: 14px; vertical-align: baseline; background-color:
> >>>>>> transparent;
> >>>>>> color: rgb(0, 0, 0); background-position: initial initial;
> >>>>>> background-repeat: initial initial;">)
> >>>>>>            at com.pingushare.bou
> >>>>>> ndary.filter.SecurityFilt
> >>>>>> er.doFilter(SecurityFilte
> >>>>>> r.java:36)
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.internalDoFilter(App
> >>>>>> licationFilterChain.java:243
> >>>>>> )
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.doFilter(Application
> >>>>>> FilterChain.java:210<
> >>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
> >>>>>> font-size: 14px; vertical-align: baseline; background-color:
> >>>>>> transparent;
> >>>>>> color: rgb(0, 0, 0); background-position: initial initial;
> >>>>>> background-repeat: initial initial;">)
> >>>>>>            at com.pingushare.bou
> >>>>>> ndary.filter.ForceFreshPa
> >>>>>> geAndWWWFilter.doFilter(F
> >>>>>> orceFreshPageAndWWWFilter.******java:49)
> >>>>>>
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.internalDoFilter(App
> >>>>>> licationFilterChain.java:243
> >>>>>> )
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.ApplicationFilterC
> >>>>>> hain.doFilter(Application
> >>>>>> FilterChain.java:210<
> >>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
> >>>>>> font-size: 14px; vertical-align: baseline; background-color:
> >>>>>> transparent;
> >>>>>> color: rgb(0, 0, 0); background-position: initial initial;
> >>>>>> background-repeat: initial initial;">)
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.StandardWrapperVal
> >>>>>> ve.invoke(StandardWrapper
> >>>>>> Valve.java:222)
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.StandardContextVal
> >>>>>> ve.invoke(StandardContext
> >>>>>>
> >>>>>> Valve.java:123)
> >>>>>>            at org.apache.tomee.catalina.******OpenEJBValve.invoke(**
> >>>>>>
> >>>>>> OpenEJBValve.java:45)
> >>>>>>            at org.apache.catalin
> >>>>>> a.authenticator.Authentic
> >>>>>> atorBase.invoke(Authentic
> >>>>>> atorBase.java:502)
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.StandardHostValve<
> >>>>>> /span>.invoke(******StandardHostValve<
> >>>>>>
> >>>>>> /span>.java:171)
> >>>>>>            at org.apache.catalin
> >>>>>> a.valves.ErrorReportValve
> >>>>>> .invoke(ErrorReportValve<
> >>>>>> /span>.java:99)
> >>>>>>            at org.apache.catalin
> >>>>>> a.valves.AccessLogValve.******invoke(AccessLogValve.java:******953)
> >>>>>>
> >>>>>>            at org.apache.catalin
> >>>>>> a.core.StandardEngineValv
> >>>>>> e.invoke(StandardEngineVa
> >>>>>> lve.java:118)
> >>>>>>            at org.apache.catalin
> >>>>>> a.connector.CoyoteAdapter
> >>>>>> .service(CoyoteAdapter.java:******408)
> >>>>>>            at org.apache.coyote<
> >>>>>> /span>.http11.******AbstractHttp11Proc
> >>>>>>
> >>>>>> essor.process(AbstractHtt
> >>>>>> p11Processor.java:1023)
> >>>>>>            at org.apache.coyote<
> >>>>>> /span>.AbstractProtocol$******AbstractConnectionHandler.**
> >>>>>> process(AbstractProtocol.java:******589)
> >>>>>>            at org.apache.tomcat<
> >>>>>> /span>.util.net.JIoEndpoint$******SocketProcessor.run(****
> >>>>>> JIoEndpoint.java:312)
> >>>>>>            at java.util.concurre
> >>>>>> nt.ThreadPoolExecutor.run
> >>>>>> Worker(ThreadPoolExecutor.******java:1145)
> >>>>>>            at java.util.concurre
> >>>>>> nt.ThreadPoolExecutor$Worker.******run(ThreadPoolExecutor.**
> >>>>>> java:****615)
> >>>>>>            at java.lang.Thr
> >>>>>> ead.run(Thread.java:724)|
> >>>>>>
> >>>>>>
> >>>>>>
> >
>

Re: Random JSF error: no saved view state could be found

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hmm,

can be interesting if you have enough time to try to reproduce it in a
shareable (on github?) project.

I'm sure it is something "stupid" we don't see ATM.

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/10/1 Zmirc <zm...@gmail.com>

> Hi!
>
> Yes, I run Majorra on Tomee 1.6.0 from 13.09.20. I will switch today to
> 13.10.01 to see if that bug with @Schedule leak disappeared.
>
> I understand your point of view and I agree. I have no idea which one has
> the bug, just that I don't get it on Majorra. (I've just deleted myfaces
> jars from Tomee and added Majorra 2.1.26 - nothing special)
>
> What settings should I give you? I didn't modify anything in Tomee,
> excepting perm gen size, heap (on production) and a few more things in
> setenv. Here's the setenv on my windows. (It's the same on linux also, just
> as .sh)
>
> set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=512m
> set JAVA_OPTS=%JAVA_OPTS% -Dorg.apache.catalina.session.**
> StandardSession.ACTIVITY_**CHECK=true
> set JAVA_OPTS=%JAVA_OPTS% -Dopenejb.session-context=http
> set JAVA_OPTS=%JAVA_OPTS% -Dfacebook4j.loggerFactory=**
> facebook4j.internal.logging.**NullLoggerFactory
>
> So...the error happens randomly (just sometimes to some users) for all
> pages that modify information and are backed by a @ViewScoped bean:
>
> The following logs are from Tomee 1.6.0 13.09.20. It happens the same on
> 1.5.2. I moved on 1.6.0 hoping to get rid of it.
>
> javax.servlet.**ServletException: /dashboard/edit-profile.**xhtmlNo saved
> view state could be found for the view identifier:
> /dashboard/edit-profile.xhtml
>     at javax.faces.webapp.**FacesServlet.service(**FacesServlet.java:213)
> ~[myfaces-api-2.1.12.jar:2.1.**12]
>     at org.apache.catalina.core.**ApplicationFilterChain.**
> internalDoFilter(**ApplicationFilterChain.java:**305)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
>     at org.primefaces.webapp.filter.**FileUploadFilter.doFilter(**FileUploadFilter.java:77)
> ~[primefaces-3.5.jar:na]
>     at org.apache.catalina.core.**ApplicationFilterChain.**
> internalDoFilter(**ApplicationFilterChain.java:**243)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
>     at org.ocpsoft.rewrite.servlet.**RewriteFilter.doFilter(**RewriteFilter.java:199)
> ~[rewrite-servlet-2.0.7.Final.**jar:2.0.7.Final]
>     at org.apache.catalina.core.**ApplicationFilterChain.**
> internalDoFilter(**ApplicationFilterChain.java:**243)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
>     at com.pingushare.boundary.**filter.ActivateAccountFilter.**doFilter(*
> *ActivateAccountFilter.java:38) ~[ActivateAccountFilter.class:**na]
>     at org.apache.catalina.core.**ApplicationFilterChain.**
> internalDoFilter(**ApplicationFilterChain.java:**243)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
>     at com.pingushare.boundary.**filter.SecurityFilter.**
> doFilter(SecurityFilter.java:**36) ~[SecurityFilter.class:na]
>     at org.apache.catalina.core.**ApplicationFilterChain.**
> internalDoFilter(**ApplicationFilterChain.java:**243)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
>     at com.pingushare.boundary.**filter.**ForceFreshPageAndWWWFilter.**
> doFilter(**ForceFreshPageAndWWWFilter.**java:41)
> ~[ForceFreshPageAndWWWFilter.**class:na]
>     at org.apache.catalina.core.**ApplicationFilterChain.**
> internalDoFilter(**ApplicationFilterChain.java:**243)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**ApplicationFilterChain.**doFilter(**
> ApplicationFilterChain.java:**210) ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**StandardWrapperValve.invoke(**StandardWrapperValve.java:222)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**StandardContextValve.invoke(**StandardContextValve.java:123)
> ~[catalina.jar:7.0.42]
>     at org.apache.tomee.catalina.**OpenEJBValve.invoke(**OpenEJBValve.java:45)
> ~[tomee-catalina-1.6.0-**SNAPSHOT.jar:1.6.0-SNAPSHOT]
>     at org.apache.catalina.**authenticator.**AuthenticatorBase.invoke(**AuthenticatorBase.java:502)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**StandardHostValve.invoke(**StandardHostValve.java:171)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.valves.**ErrorReportValve.invoke(**ErrorReportValve.java:99)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.valves.**AccessLogValve.invoke(**AccessLogValve.java:953)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.core.**StandardEngineValve.invoke(**StandardEngineValve.java:118)
> ~[catalina.jar:7.0.42]
>     at org.apache.catalina.connector.**CoyoteAdapter.service(**CoyoteAdapter.java:408)
> ~[catalina.jar:7.0.42]
>     at org.apache.coyote.http11.**AbstractHttp11Processor.**process(**
> AbstractHttp11Processor.java:**1023) ~[tomcat-coyote.jar:7.0.42]
>     at org.apache.coyote.**AbstractProtocol$**AbstractConnectionHandler.**
> process(AbstractProtocol.java:**589) ~[tomcat-coyote.jar:7.0.42]
>     at org.apache.tomcat.util.net.**JIoEndpoint$SocketProcessor.**run(JIoEndpoint.java:312)
> ~[tomcat-coyote.jar:7.0.42]
>     at java.util.concurrent.**ThreadPoolExecutor.runWorker(**ThreadPoolExecutor.java:1145)
> ~[na:1.7.0_25]
>     at java.util.concurrent.**ThreadPoolExecutor$Worker.run(**ThreadPoolExecutor.java:615)
> ~[na:1.7.0_25]
>     at java.lang.Thread.run(Thread.**java:724) ~[na:1.7.0_25]
> Caused by: javax.faces.application.**ViewExpiredException:
> /dashboard/edit-profile.**xhtmlNo saved view state could be found for the
> view identifier: /dashboard/edit-profile.xhtml
>     at org.apache.myfaces.lifecycle.**RestoreViewExecutor.execute(**RestoreViewExecutor.java:132)
> ~[myfaces-impl-2.1.12.jar:2.1.**12]
>     at org.apache.myfaces.lifecycle.**LifecycleImpl.executePhase(**LifecycleImpl.java:170)
> ~[myfaces-impl-2.1.12.jar:2.1.**12]
>     at org.apache.myfaces.lifecycle.**LifecycleImpl.execute(**LifecycleImpl.java:117)
> ~[myfaces-impl-2.1.12.jar:2.1.**12]
>     at javax.faces.webapp.**FacesServlet.service(**FacesServlet.java:197)
> ~[myfaces-api-2.1.12.jar:2.1.**12]
>     ... 32 common frames omitted
>
> I have attached one of the beans (This is the only one @RequestScoped) +
> an utility class used for redirecting. (The format might be strange because
> of NetBeans settings probably)
> The JSF(xhtml) page does just call updateAndRedirect() (redirects to
> /profile/userId) or just updateProfile() (stays on the same page) when user
> uploads a profile pic also.
>
> I've also attached a @ViewScoped bean (JSF calls add() on submit from it).
> It might look like more code, but the basic idea is simple: user goes to a
> page (edit profile, add item, edit item etc.), writes some input then
> presses Save, then, sometimes/randomly, the no state error is triggered and
> I get the above log from Tomee.
>
> It shouldn't be anything with the container session, because users are not
> deauthenticated or any similar things.
> I have no idea and it's so frustrating that I can't (I don't have) give
> you more details to reproduce it.
> I've been personally struggling with it for around 2 weeks, because it
> took some time until I've figured out that it's not my bug.
>
> If something else might be useful/necessary, I'm willing to help.
> Best wishes!
> Mircea
>
>
> On 10/1/2013 7:13 AM, Romain Manni-Bucau wrote:
>
>> Hi
>>
>> Do you run mojarra on tomee? Basically the exception you sent doesnt seem
>> complete and is not usable to help.
>>
>> About "it works with mojarra so that's mf" it is a big shortcut. It can be
>> a bug in mojarra which make it working too (im not saying it, just you
>> dont
>> know and you cant conclude since you were not able to give us any info on
>> this issue we can use to work on it)
>>
>> In all cases of you handle to reproduce please share the whole logs and
>> maybe your server settings. Tomee can be the cause too depending it.
>> Le 30 sept. 2013 23:33, "Zmirc" <zm...@gmail.com> a écrit :
>>
>>  Hi, Leonardo!
>>>
>>> Unfortunately, I've been very pressed by having to get it to work in
>>> production, so I switched this project to Majorra. Happily enough, the
>>> error didn't appear anymore, at least until now.
>>>
>>> I would have definitely loved to afford doing those tests, but it wasn't
>>> possible unfortunately.
>>> Anyway, by the fact that now it doesn't appear just by changin to
>>> Majorra,
>>> it is obvious that there might be a hidden little bug somewhere in
>>> MyFaces,
>>> otherwise it can't be explained.
>>>
>>> I'm so sorry that I can't reproduce it. It happened completely random. It
>>> might be as you suggested, a problem in creating/reloading the state. You
>>> know better than me those details.
>>>
>>> I would really like to have that bug discovered and fixed, because I was
>>> quite used to MyFaces.
>>> Thank you again for trying to help.
>>> I hope something can be done about it. I know that, without being able to
>>> reproduce it, it's a little bit hard, but I hope.
>>>
>>> Best,
>>> Mircea
>>>
>>> On 9/27/2013 11:56 AM, Leonardo Uribe wrote:
>>>
>>>  Hi
>>>>
>>>> There is no magical solutions to you problem. You should check which
>>>> value
>>>> has javax.faces.ViewState request parameter in the POST request that
>>>> causes
>>>> the ViewExpiredException. Put a filter or a PhaseListener that logs that
>>>> value when there is an incoming request to that view. The key point is
>>>> to
>>>> know if the view state token is there or not and if it has been altered
>>>> somehow between the time the page is renderer and the time the button is
>>>> clicked and the POST is sended. You need to log the token saved on the
>>>> page
>>>> too, to know the original value.
>>>>
>>>> One option I can imagine is that the value in the ViewState token is
>>>> sent
>>>> partially. The server received the trimmed token, it doesn't match
>>>> because
>>>> it is broken and it throws correctly the ViewExpiredException. But
>>>> sounds
>>>> unlikely, we need more evidence about what's going on.
>>>>
>>>> What I can say is the code in MyFaces Core is ok in that part and
>>>> specifically the state management code has been tested exhaustively. It
>>>> is
>>>> quite unlikely to find a bug in that part.
>>>>
>>>> regards,
>>>>
>>>> Leonardo Uribe
>>>>
>>>>
>>>>
>>>> 2013/9/27 Zmirc <zm...@gmail.com>
>>>>
>>>>   Hi again!
>>>>
>>>>> Any ideas / fixes for this bug?
>>>>> It's still there and is completely random.
>>>>> Moreover, I can't reproduce it.
>>>>>
>>>>> Please don't ignore it, because it's a real pain in the ...
>>>>> It's screwing up the whole project, because some users get this bug
>>>>> randomly, whenever they execute a post (command button).
>>>>>
>>>>> Thank you so so much in advance.
>>>>>
>>>>>
>>>>> On 9/25/2013 12:17 PM, Zmirc wrote:
>>>>>
>>>>>   Hi!
>>>>>
>>>>>> Some users (few) of the app I work on experience a very strange error,
>>>>>> which I can't yet reproduce.
>>>>>> Moreover, it appears in less than 10~ of executions.
>>>>>>
>>>>>> Error: No saved view state could be found for the view identifier:
>>>>>> /mypage.xhtml
>>>>>>
>>>>>> Application server: Apache Tomee 1.5.2 stable / 1.6.0-2013.09.20 dev
>>>>>> (It
>>>>>> happens on both). I use the MyFaces distribution that comes with each
>>>>>> of
>>>>>> them, so 2.1.10 / 2.1.12, so nothing new added.
>>>>>>
>>>>>> Part of web.xml
>>>>>> |<context-param>
>>>>>>            <param-name>org.apache.******
>>>>>> myfaces.USE_ENCRYPTION</param-****
>>>>>> **name>
>>>>>>            <param-value>false</param-******value>
>>>>>>          </context-param>
>>>>>>          <context-param>
>>>>>>            <param-name>javax.faces.STATE_**
>>>>>> ****SAVING_METHOD</param-name>
>>>>>>            <param-value>client</param-******value>
>>>>>>
>>>>>>          </context-param>|
>>>>>>
>>>>>> So, no state view exception shouldn't happen, because state is on
>>>>>> client.
>>>>>> It was set on server before, but I thought maybe client will fix it,
>>>>>> but
>>>>>> nothing. There was actually no difference in the occurrence of that
>>>>>> error.
>>>>>> Moreover, it's not related to deploy/redeploy/restart, because
>>>>>> encryption
>>>>>> is false. I don't experience any problem with that.
>>>>>>
>>>>>> Execution flow:
>>>>>> 1. Client opens xhtml page (JSF).
>>>>>> 2. Client clicks on an command button to do various things, button
>>>>>> connected to a public void method of a JSF @ViewScoped ManagedBean.
>>>>>> 3. Yes, the method is void because I don't need to return a String to
>>>>>> redirect to another page. I need to redirect to /page/id (example:
>>>>>> /market/24, /profile/43), therefore methods that return a String as
>>>>>> navigation destinations are useless, because I use:|FacesContext.**
>>>>>> getCurrentInstance().******getExternalContext().redirect(**
>>>>>> ****path);|
>>>>>>
>>>>>> 4. In ~90% of the cases, everything works perfectly and users are
>>>>>> redirected to each specific page. In the rest of ~10 (randomly), they
>>>>>> get|No saved view state could be found for the view identifier:
>>>>>> /pagename.xhtml
>>>>>> |Basically, the command button's method is not executed.
>>>>>>
>>>>>> I would really appreciate some help here, because I have no idea how
>>>>>> to
>>>>>> get it fixed.
>>>>>> Thanks a lot in advance.
>>>>>>
>>>>>> /*Session timeout is set to 30 days in web.xml (302400). The error
>>>>>> happens at random times for random users, but all users didn't use the
>>>>>> system yet for 30 days, so it's a little bit strange.*/
>>>>>>
>>>>>> I use PrimeFaces and I also have a couple of my own filters in
>>>>>> web.xml,
>>>>>> but that shouldn't be a problem, I hope so.
>>>>>>
>>>>>> Any ideas please? I really don't know what to do in order to fix it.
>>>>>> Thanks a lot in advance.
>>>>>> It's on StackOverflow also: http://stackoverflow.com/**
>>>>>> questions/18992241/random-jsf-******error-no-saved-view-state-****
>>>>>> could-be-found/18999855<http:/****/stackoverflow.com/**questions/**<http://stackoverflow.com/questions/**>
>>>>>> 18992241/random-jsf-error-no-****saved-view-state-could-be-**
>>>>>>
>>>>>> found/18999855<http://**stackoverflow.com/questions/**
>>>>>> 18992241/random-jsf-error-no-**saved-view-state-could-be-**
>>>>>> found/18999855<http://stackoverflow.com/questions/18992241/random-jsf-error-no-saved-view-state-could-be-found/18999855>
>>>>>> >
>>>>>> Stack trace for one of the pages:
>>>>>>
>>>>>> |25-Sep-2013  07:39:26.380  SEVERE[http-bio-80-exec-15]
>>>>>>    org.apache.catalina.core.******StandardWrapperValve.invoke
>>>>>>
>>>>>>     Servlet.service()
>>>>>>     for  servlet[Faces  Servlet]  in  contextwith  path[]  threw
>>>>>> exception[/dashboard/edit-******profile.xhtmlNo saved view state
>>>>>> could be
>>>>>>
>>>>>> foundfor  the view identifier:  /dashboard/edit-profile.xhtml]  with
>>>>>>   root
>>>>>> cause
>>>>>>     javax.faces.application.******ViewExpiredException:
>>>>>>    /dashboard/edit-profile.******xhtmlNo saved view state could be
>>>>>>
>>>>>> foundfor
>>>>>>    the view identifier:  /dashboard/edit-profile.xhtml
>>>>>>            at org.apache.myfaces
>>>>>> .lifecycle.RestoreViewExe
>>>>>> cutor.execute(RestoreView
>>>>>> Executor.java:132)
>>>>>>            at org.apache.myfaces
>>>>>> .lifecycle.LifecycleImpl<
>>>>>> /span>.executePhase(******LifecycleImp
>>>>>>
>>>>>> l.java:170)
>>>>>>            at org.apache.myfaces
>>>>>> .lifecycle.LifecycleImpl<
>>>>>> /span>.execute(LifecycleImpl.******java:117)
>>>>>>            at javax.faces.webapp
>>>>>> .FacesServlet.service(******FacesServlet.java:197)
>>>>>>
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.internalDoFilter(App
>>>>>> licationFilterChain.java:305
>>>>>> )
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.doFilter(Application
>>>>>> FilterChain.java:210<
>>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>>> transparent;
>>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>>> background-repeat: initial initial;">)
>>>>>>            at org.primefaces.web
>>>>>> app.filter.FileUploadFilt
>>>>>> er.doFilter(FileUploadFil
>>>>>> ter.java:77)
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.internalDoFilter(App
>>>>>> licationFilterChain.java:243
>>>>>> )
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.doFilter(Application
>>>>>> FilterChain.java:210<
>>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>>> transparent;
>>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>>> background-repeat: initial initial;">)
>>>>>>            at org.ocpsoft.rewrit
>>>>>> e.servlet.RewriteFilter.******doFilter(RewriteFilter.java:******199)
>>>>>>
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.internalDoFilter(App
>>>>>> licationFilterChain.java:243
>>>>>> )
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.doFilter(Application
>>>>>> FilterChain.java:210<
>>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>>> transparent;
>>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>>> background-repeat: initial initial;">)
>>>>>>            at com.pingushare.bou
>>>>>> ndary.filter.ActivateAcco
>>>>>> untFilter.doFilter(Activa
>>>>>> teAccountFilter.java:37)
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.internalDoFilter(App
>>>>>> licationFilterChain.java:243
>>>>>> )
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.doFilter(Application
>>>>>> FilterChain.java:210<
>>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>>> transparent;
>>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>>> background-repeat: initial initial;">)
>>>>>>            at com.pingushare.bou
>>>>>> ndary.filter.SecurityFilt
>>>>>> er.doFilter(SecurityFilte
>>>>>> r.java:36)
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.internalDoFilter(App
>>>>>> licationFilterChain.java:243
>>>>>> )
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.doFilter(Application
>>>>>> FilterChain.java:210<
>>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>>> transparent;
>>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>>> background-repeat: initial initial;">)
>>>>>>            at com.pingushare.bou
>>>>>> ndary.filter.ForceFreshPa
>>>>>> geAndWWWFilter.doFilter(F
>>>>>> orceFreshPageAndWWWFilter.******java:49)
>>>>>>
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.internalDoFilter(App
>>>>>> licationFilterChain.java:243
>>>>>> )
>>>>>>            at org.apache.catalin
>>>>>> a.core.ApplicationFilterC
>>>>>> hain.doFilter(Application
>>>>>> FilterChain.java:210<
>>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>>> transparent;
>>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>>> background-repeat: initial initial;">)
>>>>>>            at org.apache.catalin
>>>>>> a.core.StandardWrapperVal
>>>>>> ve.invoke(StandardWrapper
>>>>>> Valve.java:222)
>>>>>>            at org.apache.catalin
>>>>>> a.core.StandardContextVal
>>>>>> ve.invoke(StandardContext
>>>>>>
>>>>>> Valve.java:123)
>>>>>>            at org.apache.tomee.catalina.******OpenEJBValve.invoke(**
>>>>>>
>>>>>> OpenEJBValve.java:45)
>>>>>>            at org.apache.catalin
>>>>>> a.authenticator.Authentic
>>>>>> atorBase.invoke(Authentic
>>>>>> atorBase.java:502)
>>>>>>            at org.apache.catalin
>>>>>> a.core.StandardHostValve<
>>>>>> /span>.invoke(******StandardHostValve<
>>>>>>
>>>>>> /span>.java:171)
>>>>>>            at org.apache.catalin
>>>>>> a.valves.ErrorReportValve
>>>>>> .invoke(ErrorReportValve<
>>>>>> /span>.java:99)
>>>>>>            at org.apache.catalin
>>>>>> a.valves.AccessLogValve.******invoke(AccessLogValve.java:******953)
>>>>>>
>>>>>>            at org.apache.catalin
>>>>>> a.core.StandardEngineValv
>>>>>> e.invoke(StandardEngineVa
>>>>>> lve.java:118)
>>>>>>            at org.apache.catalin
>>>>>> a.connector.CoyoteAdapter
>>>>>> .service(CoyoteAdapter.java:******408)
>>>>>>            at org.apache.coyote<
>>>>>> /span>.http11.******AbstractHttp11Proc
>>>>>>
>>>>>> essor.process(AbstractHtt
>>>>>> p11Processor.java:1023)
>>>>>>            at org.apache.coyote<
>>>>>> /span>.AbstractProtocol$******AbstractConnectionHandler.**
>>>>>> process(AbstractProtocol.java:******589)
>>>>>>            at org.apache.tomcat<
>>>>>> /span>.util.net.JIoEndpoint$******SocketProcessor.run(****
>>>>>> JIoEndpoint.java:312)
>>>>>>            at java.util.concurre
>>>>>> nt.ThreadPoolExecutor.run
>>>>>> Worker(ThreadPoolExecutor.******java:1145)
>>>>>>            at java.util.concurre
>>>>>> nt.ThreadPoolExecutor$Worker.******run(ThreadPoolExecutor.**
>>>>>> java:****615)
>>>>>>            at java.lang.Thr
>>>>>> ead.run(Thread.java:724)|
>>>>>>
>>>>>>
>>>>>>
>

Re: Random JSF error: no saved view state could be found

Posted by Zmirc <zm...@gmail.com>.
Hi!

Yes, I run Majorra on Tomee 1.6.0 from 13.09.20. I will switch today to 
13.10.01 to see if that bug with @Schedule leak disappeared.

I understand your point of view and I agree. I have no idea which one 
has the bug, just that I don't get it on Majorra. (I've just deleted 
myfaces jars from Tomee and added Majorra 2.1.26 - nothing special)

What settings should I give you? I didn't modify anything in Tomee, 
excepting perm gen size, heap (on production) and a few more things in 
setenv. Here's the setenv on my windows. (It's the same on linux also, 
just as .sh)

set JAVA_OPTS=%JAVA_OPTS% -XX:MaxPermSize=512m
set JAVA_OPTS=%JAVA_OPTS% 
-Dorg.apache.catalina.session.StandardSession.ACTIVITY_CHECK=true
set JAVA_OPTS=%JAVA_OPTS% -Dopenejb.session-context=http
set JAVA_OPTS=%JAVA_OPTS% 
-Dfacebook4j.loggerFactory=facebook4j.internal.logging.NullLoggerFactory

So...the error happens randomly (just sometimes to some users) for all 
pages that modify information and are backed by a @ViewScoped bean:

The following logs are from Tomee 1.6.0 13.09.20. It happens the same on 
1.5.2. I moved on 1.6.0 hoping to get rid of it.

javax.servlet.ServletException: /dashboard/edit-profile.xhtmlNo saved 
view state could be found for the view identifier: 
/dashboard/edit-profile.xhtml
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213) 
~[myfaces-api-2.1.12.jar:2.1.12]
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
~[catalina.jar:7.0.42]
     at 
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:77) 
~[primefaces-3.5.jar:na]
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
~[catalina.jar:7.0.42]
     at 
org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:199) 
~[rewrite-servlet-2.0.7.Final.jar:2.0.7.Final]
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
~[catalina.jar:7.0.42]
     at 
com.pingushare.boundary.filter.ActivateAccountFilter.doFilter(ActivateAccountFilter.java:38) 
~[ActivateAccountFilter.class:na]
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
~[catalina.jar:7.0.42]
     at 
com.pingushare.boundary.filter.SecurityFilter.doFilter(SecurityFilter.java:36) 
~[SecurityFilter.class:na]
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
~[catalina.jar:7.0.42]
     at 
com.pingushare.boundary.filter.ForceFreshPageAndWWWFilter.doFilter(ForceFreshPageAndWWWFilter.java:41) 
~[ForceFreshPageAndWWWFilter.class:na]
     at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) 
~[catalina.jar:7.0.42]
     at 
org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45) 
~[tomee-catalina-1.6.0-SNAPSHOT.jar:1.6.0-SNAPSHOT]
     at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) ~[catalina.jar:7.0.42]
     at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
~[catalina.jar:7.0.42]
     at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 
~[catalina.jar:7.0.42]
     at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) 
~[tomcat-coyote.jar:7.0.42]
     at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) 
~[tomcat-coyote.jar:7.0.42]
     at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) 
~[tomcat-coyote.jar:7.0.42]
     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
~[na:1.7.0_25]
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
~[na:1.7.0_25]
     at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: javax.faces.application.ViewExpiredException: 
/dashboard/edit-profile.xhtmlNo saved view state could be found for the 
view identifier: /dashboard/edit-profile.xhtml
     at 
org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:132) 
~[myfaces-impl-2.1.12.jar:2.1.12]
     at 
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170) 
~[myfaces-impl-2.1.12.jar:2.1.12]
     at 
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) 
~[myfaces-impl-2.1.12.jar:2.1.12]
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) 
~[myfaces-api-2.1.12.jar:2.1.12]
     ... 32 common frames omitted

I have attached one of the beans (This is the only one @RequestScoped) + 
an utility class used for redirecting. (The format might be strange 
because of NetBeans settings probably)
The JSF(xhtml) page does just call updateAndRedirect() (redirects to 
/profile/userId) or just updateProfile() (stays on the same page) when 
user uploads a profile pic also.

I've also attached a @ViewScoped bean (JSF calls add() on submit from 
it). It might look like more code, but the basic idea is simple: user 
goes to a page (edit profile, add item, edit item etc.), writes some 
input then presses Save, then, sometimes/randomly, the no state error is 
triggered and I get the above log from Tomee.

It shouldn't be anything with the container session, because users are 
not deauthenticated or any similar things.
I have no idea and it's so frustrating that I can't (I don't have) give 
you more details to reproduce it.
I've been personally struggling with it for around 2 weeks, because it 
took some time until I've figured out that it's not my bug.

If something else might be useful/necessary, I'm willing to help.
Best wishes!
Mircea

On 10/1/2013 7:13 AM, Romain Manni-Bucau wrote:
> Hi
>
> Do you run mojarra on tomee? Basically the exception you sent doesnt seem
> complete and is not usable to help.
>
> About "it works with mojarra so that's mf" it is a big shortcut. It can be
> a bug in mojarra which make it working too (im not saying it, just you dont
> know and you cant conclude since you were not able to give us any info on
> this issue we can use to work on it)
>
> In all cases of you handle to reproduce please share the whole logs and
> maybe your server settings. Tomee can be the cause too depending it.
> Le 30 sept. 2013 23:33, "Zmirc" <zm...@gmail.com> a écrit :
>
>> Hi, Leonardo!
>>
>> Unfortunately, I've been very pressed by having to get it to work in
>> production, so I switched this project to Majorra. Happily enough, the
>> error didn't appear anymore, at least until now.
>>
>> I would have definitely loved to afford doing those tests, but it wasn't
>> possible unfortunately.
>> Anyway, by the fact that now it doesn't appear just by changin to Majorra,
>> it is obvious that there might be a hidden little bug somewhere in MyFaces,
>> otherwise it can't be explained.
>>
>> I'm so sorry that I can't reproduce it. It happened completely random. It
>> might be as you suggested, a problem in creating/reloading the state. You
>> know better than me those details.
>>
>> I would really like to have that bug discovered and fixed, because I was
>> quite used to MyFaces.
>> Thank you again for trying to help.
>> I hope something can be done about it. I know that, without being able to
>> reproduce it, it's a little bit hard, but I hope.
>>
>> Best,
>> Mircea
>>
>> On 9/27/2013 11:56 AM, Leonardo Uribe wrote:
>>
>>> Hi
>>>
>>> There is no magical solutions to you problem. You should check which value
>>> has javax.faces.ViewState request parameter in the POST request that
>>> causes
>>> the ViewExpiredException. Put a filter or a PhaseListener that logs that
>>> value when there is an incoming request to that view. The key point is to
>>> know if the view state token is there or not and if it has been altered
>>> somehow between the time the page is renderer and the time the button is
>>> clicked and the POST is sended. You need to log the token saved on the
>>> page
>>> too, to know the original value.
>>>
>>> One option I can imagine is that the value in the ViewState token is sent
>>> partially. The server received the trimmed token, it doesn't match because
>>> it is broken and it throws correctly the ViewExpiredException. But sounds
>>> unlikely, we need more evidence about what's going on.
>>>
>>> What I can say is the code in MyFaces Core is ok in that part and
>>> specifically the state management code has been tested exhaustively. It is
>>> quite unlikely to find a bug in that part.
>>>
>>> regards,
>>>
>>> Leonardo Uribe
>>>
>>>
>>>
>>> 2013/9/27 Zmirc <zm...@gmail.com>
>>>
>>>   Hi again!
>>>> Any ideas / fixes for this bug?
>>>> It's still there and is completely random.
>>>> Moreover, I can't reproduce it.
>>>>
>>>> Please don't ignore it, because it's a real pain in the ...
>>>> It's screwing up the whole project, because some users get this bug
>>>> randomly, whenever they execute a post (command button).
>>>>
>>>> Thank you so so much in advance.
>>>>
>>>>
>>>> On 9/25/2013 12:17 PM, Zmirc wrote:
>>>>
>>>>   Hi!
>>>>> Some users (few) of the app I work on experience a very strange error,
>>>>> which I can't yet reproduce.
>>>>> Moreover, it appears in less than 10~ of executions.
>>>>>
>>>>> Error: No saved view state could be found for the view identifier:
>>>>> /mypage.xhtml
>>>>>
>>>>> Application server: Apache Tomee 1.5.2 stable / 1.6.0-2013.09.20 dev (It
>>>>> happens on both). I use the MyFaces distribution that comes with each of
>>>>> them, so 2.1.10 / 2.1.12, so nothing new added.
>>>>>
>>>>> Part of web.xml
>>>>> |<context-param>
>>>>>            <param-name>org.apache.****myfaces.USE_ENCRYPTION</param-**
>>>>> **name>
>>>>>            <param-value>false</param-****value>
>>>>>          </context-param>
>>>>>          <context-param>
>>>>>            <param-name>javax.faces.STATE_****SAVING_METHOD</param-name>
>>>>>            <param-value>client</param-****value>
>>>>>          </context-param>|
>>>>>
>>>>> So, no state view exception shouldn't happen, because state is on
>>>>> client.
>>>>> It was set on server before, but I thought maybe client will fix it, but
>>>>> nothing. There was actually no difference in the occurrence of that
>>>>> error.
>>>>> Moreover, it's not related to deploy/redeploy/restart, because
>>>>> encryption
>>>>> is false. I don't experience any problem with that.
>>>>>
>>>>> Execution flow:
>>>>> 1. Client opens xhtml page (JSF).
>>>>> 2. Client clicks on an command button to do various things, button
>>>>> connected to a public void method of a JSF @ViewScoped ManagedBean.
>>>>> 3. Yes, the method is void because I don't need to return a String to
>>>>> redirect to another page. I need to redirect to /page/id (example:
>>>>> /market/24, /profile/43), therefore methods that return a String as
>>>>> navigation destinations are useless, because I use:|FacesContext.**
>>>>> getCurrentInstance().****getExternalContext().redirect(****path);|
>>>>> 4. In ~90% of the cases, everything works perfectly and users are
>>>>> redirected to each specific page. In the rest of ~10 (randomly), they
>>>>> get|No saved view state could be found for the view identifier:
>>>>> /pagename.xhtml
>>>>> |Basically, the command button's method is not executed.
>>>>>
>>>>> I would really appreciate some help here, because I have no idea how to
>>>>> get it fixed.
>>>>> Thanks a lot in advance.
>>>>>
>>>>> /*Session timeout is set to 30 days in web.xml (302400). The error
>>>>> happens at random times for random users, but all users didn't use the
>>>>> system yet for 30 days, so it's a little bit strange.*/
>>>>>
>>>>> I use PrimeFaces and I also have a couple of my own filters in web.xml,
>>>>> but that shouldn't be a problem, I hope so.
>>>>>
>>>>> Any ideas please? I really don't know what to do in order to fix it.
>>>>> Thanks a lot in advance.
>>>>> It's on StackOverflow also: http://stackoverflow.com/**
>>>>> questions/18992241/random-jsf-****error-no-saved-view-state-**
>>>>> could-be-found/18999855<http:/**/stackoverflow.com/questions/**
>>>>> 18992241/random-jsf-error-no-**saved-view-state-could-be-**
>>>>> found/18999855<http://stackoverflow.com/questions/18992241/random-jsf-error-no-saved-view-state-could-be-found/18999855>
>>>>> Stack trace for one of the pages:
>>>>>
>>>>> |25-Sep-2013  07:39:26.380  SEVERE[http-bio-80-exec-15]
>>>>>    org.apache.catalina.core.****StandardWrapperValve.invoke
>>>>>     Servlet.service()
>>>>>     for  servlet[Faces  Servlet]  in  contextwith  path[]  threw
>>>>> exception[/dashboard/edit-****profile.xhtmlNo saved view state could be
>>>>> foundfor  the view identifier:  /dashboard/edit-profile.xhtml]  with
>>>>>   root
>>>>> cause
>>>>>     javax.faces.application.****ViewExpiredException:
>>>>>    /dashboard/edit-profile.****xhtmlNo saved view state could be
>>>>> foundfor
>>>>>    the view identifier:  /dashboard/edit-profile.xhtml
>>>>>            at org.apache.myfaces
>>>>> .lifecycle.RestoreViewExe
>>>>> cutor.execute(RestoreView
>>>>> Executor.java:132)
>>>>>            at org.apache.myfaces
>>>>> .lifecycle.LifecycleImpl<
>>>>> /span>.executePhase(****LifecycleImp
>>>>> l.java:170)
>>>>>            at org.apache.myfaces
>>>>> .lifecycle.LifecycleImpl<
>>>>> /span>.execute(LifecycleImpl.****java:117)
>>>>>            at javax.faces.webapp
>>>>> .FacesServlet.service(****FacesServlet.java:197)
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.internalDoFilter(App
>>>>> licationFilterChain.java:305
>>>>> )
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.doFilter(Application
>>>>> FilterChain.java:210<
>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>> transparent;
>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>> background-repeat: initial initial;">)
>>>>>            at org.primefaces.web
>>>>> app.filter.FileUploadFilt
>>>>> er.doFilter(FileUploadFil
>>>>> ter.java:77)
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.internalDoFilter(App
>>>>> licationFilterChain.java:243
>>>>> )
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.doFilter(Application
>>>>> FilterChain.java:210<
>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>> transparent;
>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>> background-repeat: initial initial;">)
>>>>>            at org.ocpsoft.rewrit
>>>>> e.servlet.RewriteFilter.****doFilter(RewriteFilter.java:****199)
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.internalDoFilter(App
>>>>> licationFilterChain.java:243
>>>>> )
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.doFilter(Application
>>>>> FilterChain.java:210<
>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>> transparent;
>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>> background-repeat: initial initial;">)
>>>>>            at com.pingushare.bou
>>>>> ndary.filter.ActivateAcco
>>>>> untFilter.doFilter(Activa
>>>>> teAccountFilter.java:37)
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.internalDoFilter(App
>>>>> licationFilterChain.java:243
>>>>> )
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.doFilter(Application
>>>>> FilterChain.java:210<
>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>> transparent;
>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>> background-repeat: initial initial;">)
>>>>>            at com.pingushare.bou
>>>>> ndary.filter.SecurityFilt
>>>>> er.doFilter(SecurityFilte
>>>>> r.java:36)
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.internalDoFilter(App
>>>>> licationFilterChain.java:243
>>>>> )
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.doFilter(Application
>>>>> FilterChain.java:210<
>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>> transparent;
>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>> background-repeat: initial initial;">)
>>>>>            at com.pingushare.bou
>>>>> ndary.filter.ForceFreshPa
>>>>> geAndWWWFilter.doFilter(F
>>>>> orceFreshPageAndWWWFilter.****java:49)
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.internalDoFilter(App
>>>>> licationFilterChain.java:243
>>>>> )
>>>>>            at org.apache.catalin
>>>>> a.core.ApplicationFilterC
>>>>> hain.doFilter(Application
>>>>> FilterChain.java:210<
>>>>> span class="pun" style="margin: 0px; padding: 0px; border: 0px;
>>>>> font-size: 14px; vertical-align: baseline; background-color:
>>>>> transparent;
>>>>> color: rgb(0, 0, 0); background-position: initial initial;
>>>>> background-repeat: initial initial;">)
>>>>>            at org.apache.catalin
>>>>> a.core.StandardWrapperVal
>>>>> ve.invoke(StandardWrapper
>>>>> Valve.java:222)
>>>>>            at org.apache.catalin
>>>>> a.core.StandardContextVal
>>>>> ve.invoke(StandardContext
>>>>>
>>>>> Valve.java:123)
>>>>>            at org.apache.tomee.catalina.****OpenEJBValve.invoke(**
>>>>> OpenEJBValve.java:45)
>>>>>            at org.apache.catalin
>>>>> a.authenticator.Authentic
>>>>> atorBase.invoke(Authentic
>>>>> atorBase.java:502)
>>>>>            at org.apache.catalin
>>>>> a.core.StandardHostValve<
>>>>> /span>.invoke(****StandardHostValve<
>>>>> /span>.java:171)
>>>>>            at org.apache.catalin
>>>>> a.valves.ErrorReportValve
>>>>> .invoke(ErrorReportValve<
>>>>> /span>.java:99)
>>>>>            at org.apache.catalin
>>>>> a.valves.AccessLogValve.****invoke(AccessLogValve.java:****953)
>>>>>            at org.apache.catalin
>>>>> a.core.StandardEngineValv
>>>>> e.invoke(StandardEngineVa
>>>>> lve.java:118)
>>>>>            at org.apache.catalin
>>>>> a.connector.CoyoteAdapter
>>>>> .service(CoyoteAdapter.java:****408)
>>>>>            at org.apache.coyote<
>>>>> /span>.http11.****AbstractHttp11Proc
>>>>> essor.process(AbstractHtt
>>>>> p11Processor.java:1023)
>>>>>            at org.apache.coyote<
>>>>> /span>.AbstractProtocol$****AbstractConnectionHandler.**
>>>>> process(AbstractProtocol.java:****589)
>>>>>            at org.apache.tomcat<
>>>>> /span>.util.net.JIoEndpoint$****SocketProcessor.run(****
>>>>> JIoEndpoint.java:312)
>>>>>            at java.util.concurre
>>>>> nt.ThreadPoolExecutor.run
>>>>> Worker(ThreadPoolExecutor.****java:1145)
>>>>>            at java.util.concurre
>>>>> nt.ThreadPoolExecutor$Worker.****run(ThreadPoolExecutor.java:****615)
>>>>>            at java.lang.Thr
>>>>> ead.run(Thread.java:724)|
>>>>>
>>>>>