Session timeouts result in a java.lang.IllegalArgumentException: null source 
instead of javax.faces.application.ViewExpiredException
------------------------------------------------------------------------------------------------------------------------------------

                 Key: TRINIDAD-2243
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2243
             Project: MyFaces Trinidad
          Issue Type: Bug
    Affects Versions: 2.0.1-core
         Environment: Windows 7
1.7.0_02
WebLogic 12
JSF 2.1 - Mojarra 2.1.5
Trinidad 2.0.1
            Reporter: Matthieu Chase Heimer


Any session timeout results in a java.lang.IllegalArgumentException instead of 
javax.faces.application.ViewExpiredException when interacting with an already 
rendered page.

My test case is:
<?xml version='1.0' encoding='UTF-8' ?>
<tr:document xmlns="http://www.w3.org/1999/xhtml";
             xmlns:h="http://java.sun.com/jsf/html";
             xmlns:tr="http://myfaces.apache.org/trinidad";
             title="Trinidad Test">
    
    <h:form>
        <h:inputText value="#{sessionScope.vaule}"/>
        <h:commandButton value="Submit"/>
    </h:form>
    
</tr:document>

To duplicate the problem. Load the page, submit a value, wait longer than the 
session timeout value, attempt to submit a new value.

The result is an error page that says:
An Error Occurred:
null source

Stack Trace:
java.lang.IllegalArgumentException: null source
        at java.util.EventObject.<init>(EventObject.java:56)
        at javax.faces.event.SystemEvent.<init>(SystemEvent.java:71)
        at 
javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:73)
        at 
javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:73)
        at 
com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:271)
        at 
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:257)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at 
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
        at 
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
        at 
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
        at 
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
        at 
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:352)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
        at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
        at 
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
        at 
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
        at 
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
        at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
        at 
weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)
        at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3288)
        at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
        at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at 
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at 
weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
        at 
weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
        at 
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
        at 
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
        at 
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1512)
        at 
weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)


Also in the console window there will be:
Mar 15, 2012 6:32:23 PM 
org.apache.myfaces.trinidadinternal.application.StateManagerImpl restoreView
SEVERE: Could not find saved view state for token -8jkyfr8dt

The workaround is to modify the web.xml to include:
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_METHOD</param-name>
        <param-value>all</param-value>
    </context-param>

TL;DR: Trinidad swallows the javax.faces.application.ViewExpiredException 
exception making it impossible to handle session timeouts when storing state on 
the server.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to