4 Replies Latest reply on Apr 4, 2011 6:52 PM by Eric Demorsy

    Context is already active when navigating with a s:viewAction

    Eric Demorsy Newbie

      Hi folks,


      Big congrats on the Seam 3 final release, I'm glad I went for it for our company :)


      I'm quite interested by the viewAction feature of Seam Faces, as I need to redirect users to different subscription processes depending on a GET parameter. However, when I try to perform the redirection I get this StackTrace:




      java.lang.IllegalStateException: Context is already active
              org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:301)
              org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:110)
              org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:84)
              com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224)
              com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95)
              com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
              com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
              org.jboss.seam.faces.component.UIViewAction.broadcast(UIViewAction.java:389)
              javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
              javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:922)
              com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:74)
              com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
              com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
              org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)



      I've trimmed down the war to make it easily testable, now my redirection page looks like this:


      
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:s="http://jboss.org/seam/faces"
            xmlns:ui="http://java.sun.com/jsf/facelets"> 
      
      <h:head>
              <f:metadata>
               <s:viewAction action="#{testBean.doRedir}"/>
              </f:metadata>
      </h:head> 
      <body> 
      Redirect test page
      </body> 
      </html>



      And my bean is:



      package demo;
      
      import javax.enterprise.inject.Model;
      
      @Model
      public class TestBean {
      
              public String doRedir() {
                      return "redirTarget";
              }
              
      }
      



      If I remove the redirTarget.xhtml page, nothing happens, which is ok since implicit navigation isn't possible. If I put back redirTarget.xhtml (which is basically an empty page), I get the stacktrace above. Could it be related to WELD-877 ? I'm going to try and upload my war if I can.


      Regards,


      Eric