Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Invalid
-
2.0.2
-
None
-
None
-
Deployment running under glassfish or Google App engine but probably happens on all app servers.
Description
This is a tricky one. I made a small testing app thanks to the commentary of a user who wanted to run MyFaces in GAE and caused a condition which occasionally occurs, which prevents the ViewState to be found.
Here is the mechanis. I have a small test app which loads a page. The page triggers a jsf.ajax request from time to time with render none, periodically but not connected to the session timeout I am getting single error returns from my ajax request from the server:
Working Request before:
Request
j_id1631913672_61450686 j_id1631913672_61450686
j_id1631913672_61450686_S... 1
javax.faces.ViewState XsWFBIdJ3cAipIW1n5/t3iVN5WSwWxZx2zbF0fTt/gvRo//LO3glFrGpAY8IMulyF7vG3zU1dN9lR7tFYcOwrVKKk107jlZKitmWUhl9XeNBb34eh5bt8QyDTVM=
javax.faces.partial.ajax true
javax.faces.partial.execu... menu @this
javax.faces.source menu
menu 1
menu2 1
Response
<?xml version="1.0" encoding="utf-8"?><partial-response><changes><update id="javax.faces.ViewState"><![CDATA[XsWFBIdJ3cAipIW1n5/t3iVN5WSwWxZx2zbF0fTt/gvRo//LO3glFrGpAY8IMulyOsU+YvfYynFlR7tFYcOwrVKKk107jlZKdUuJGd3B0bumy+XxfxY80nPViy4=]]></update></changes></partial-response>
After that following error request:
j_id1631913672_61450686 j_id1631913672_61450686
j_id1631913672_61450686_S... 1
javax.faces.ViewState XsWFBIdJ3cAipIW1n5/t3iVN5WSwWxZx2zbF0fTt/gvRo//LO3glFrGpAY8IMulyOsU+YvfYynFlR7tFYcOwrVKKk107jlZKdUuJGd3B0bumy+XxfxY80nPViy4=
javax.faces.partial.ajax true
javax.faces.partial.execu... menu @this
javax.faces.source menu
menu 1
menu2 1
<?xml version="1.0" encoding="utf-8"?><partial-response><error><error-name>javax.faces.application.ViewExpiredException</error-name><error-message><![CDATA[/welcome.jsfNo saved view state could be found for the view identifier: /welcome.jsf]]></error-message></error></partial-response>
And aftert hat I am getting a normal answer again:
j_id1631913672_61450686 j_id1631913672_61450686
j_id1631913672_61450686_S... 1
javax.faces.ViewState XsWFBIdJ3cAipIW1n5/t3iVN5WSwWxZx2zbF0fTt/gvRo//LO3glFrGpAY8IMulyOsU+YvfYynFlR7tFYcOwrVKKk107jlZKdUuJGd3B0bumy+XxfxY80nPViy4=
javax.faces.partial.ajax true
javax.faces.partial.execu... menu @this
javax.faces.source menu
menu 1
menu2 1
<?xml version="1.0" encoding="utf-8"?><partial-response><changes><update id="javax.faces.ViewState"><![CDATA[XsWFBIdJ3cAipIW1n5/t3iVN5WSwWxZx2zbF0fTt/gvRo//LO3glFrGpAY8IMuly5RE5nlKK54RlR7tFYcOwrVKKk107jlZK6f7NdUZRuvvbL7VYnmj4v8VmnIQ=]]></update></changes></partial-response>
As it is visible here the viewstate between the error and the visible request are the same, it is just that in the first instance it was not able to restore the view
The error I have gotten on the console is as follows:
javax.faces.application.ViewExpiredException: /welcome.jsfNo saved view state could be found for the view identifier: /welcome.jsf
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:680)
The web.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!--
We need to set annotation lifecycyle provider manually as org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.
Other providers use some classes that are restricted on Google App Engine.
-->
<context-param>
<param-name>org.apache.myfaces.config.annotation.LifecycleProvider</param-name>
<param-value>org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider</param-value>
</context-param>
<!--
Need to set a secret to avoid javax.crypto.BadPaddingException.
"param-value" must be Base64 encoded.
More details: http://wiki.apache.org/myfaces/Secure_Your_Application
-->
<!--
<context-param>
<param-name>org.apache.myfaces.SECRET</param-name>
<param-value>NzY1NDMyMTA=</param-value>
</context-param>
-->
<!-- Defines the secret (Base64 encoded) used to initialize the secret key
for encryption algorithm. The size of it depends on the algorithm used for encryption -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
So the use encryption param is on default and no key overrides are set!
The link to the app is as follows:
http://people.apache.org/~werpu/tesinck4040.tar.bz2 (note that you have to remove the encryption param there from the web.xml)