0 Replies Latest reply on Nov 24, 2008 11:31 AM by jaro skraban

    Portal event and ViewExpiredException

    jaro skraban Newbie

      Hello,

      I got following issue.

      Environment:
      jboss-portal-2.7.0.GA (bundled version) -> JSF RI 1.2_08 and Jboss portlet bridge 1.0.0.B4

      I have PortletA and PortletB - both are JSF portlets. PortletA publishes Event and PortletB processes it. Sometimes when event is triggered from PortletA, ViewExpiredException is thrown during restoring view of PortletB

      Caused by: javax.faces.application.ViewExpiredException: viewId:/scsearch/scsearchdetail.jsp - View /scsearch/scsearchdetail.jsp could not be restored.
       at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:186)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
       at org.jboss.portletbridge.AjaxPortletBridge.execute(AjaxPortletBridge.java:587)
       at org.jboss.portletbridge.AjaxPortletBridge.renderResponse(AjaxPortletBridge.java:441)
       at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:344)


      As workaround this partly works (at least stack trace is not displayed though event is not processed) - add it to web.xml of PortletB's war
      <context-param>
       <param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
       <param-value>true</param-value>
      


      Still not satisfied with "solution" I debug JSF and came to strange conclusion: JSF adds hidden field into form (there is form in both PortletA and PortletB underlying jsp page) like

      <INPUT id="javax.faces.ViewState" type="hidden" name="javax.faces.ViewState" value="j_id9" /> w
       </context-param>
      


      This values stores version of view stored in session for particular view. Problem is that the same version is used for both portlets - in case that PortletB does have such a version (e.g. html would like like)


      <INPUT id="javax.faces.ViewState" type="hidden" name="javax.faces.ViewState" value="j_id8" /> w
       </context-param>
      


      than no view is found and ViewExpiredException is thrown.

      Any idea how to solve this properly?

      Thanks
      Jaro