title: JSF Session Fail over and Partial State Saving
body: <p>Running on JSF 2.0.9, Weblogic 10.3.4.  We're now running JSF in our production environment but have encountered some issues with Session Replication and fail over. We are using viewscope for our beans and I have ensured they are Serializable/transient and that the transient variables are effectively stateless.  However session fail over is not working.  I have done extensive testing and managed to get it working by setting the following params in web.xml</p>
  
  <pre><code>    &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
          &lt;param-value&gt;client&lt;/param-value&gt;
      &lt;/context-param&gt;
  
  
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.PARTIAL_STATE_SAVING&lt;/param-name&gt;
          &lt;param-value&gt;false&lt;/param-value&gt;
      &lt;/context-param&gt;
  </code></pre>
  
  <p>If I set <code>STATE_SAVING_METHOD</code> to <code>server</code> I get a viewexpired exception on failover. If I set to <code>client</code> with <code>PARTIAL_STATE_SAVING</code> to <code>true</code> I get the following error:</p>
  
  <pre><code>java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      at java.util.ArrayList.get(ArrayList.java:322)
      at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:165)
      at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1433)
      at com.sun.faces.application.view.StateManagementStrategyImpl$1.visit(StateManagementStrategyImpl.java:265)
      at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:151)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1507)
      at javax.faces.component.UIComponent.visitTree(UIComponent.java:1521)
      at com.sun.faces.component.visit.VisitUtils.doFullNonIteratingVisit(VisitUtils.java:75)
      at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:282)
      at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:181)
      at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:448)
      at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:148)
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:187)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:111)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
  </code></pre>
  
  <p>So my questions are these:</p>
  
  <ul>
  <li>Is <code>STATE_SAVING_METHOD</code> - <code>client</code> &amp; <code>PARTIAL_STATE_SAVING</code> - <code>false</code> the only way I'm going to get failover to work? </li>
  <li>What is the cost of client/false combination. Is this memory/cpu extensive?</li>
  <li>Is this a bug and if so is it resolved in 2.1 or 2.2?</li>
  </ul>
  
  <p>Thanks in advance.</p>