1 Reply Latest reply on Jul 5, 2011 5:32 PM by xcdemon

    No Conversations at all?

    wukumukudawe

      Hi,


      I am using
      Jboss 6.0.0 Final
      with standard libs.


      I try to make a little ConversationScoped bean:


      import javax.enterprise.context.Conversation;
      import javax.enterprise.context.ConversationScoped;
      @Named
      @ConversationScoped
      public class ViewBean implements Serializable {

      @Inject
          private Conversation conversation;

      public void start() {
          if (conversation.isTransient()) {
              System.out.println("START CONVERSATION");
              conversation.begin();

          }
      }


      I tried to call the start method using @PostConstruct as well as using:
              <f:metadata>
                  <f:event type="preRenderView" listener="#{viewBean.start}" />
              </f:metadata>


      RequestScoped Beans and SessionScoped beans work as expected, but the conversation is always transient.
      I debuged as following:
      - Open the JSF page
      - The start method is beeing called
      - The conversation is started
      - I hit reload in my browser
      - The start method is beeing called
      - The conversation is transient..........is that correct?


      So is changed it to:
         
         @Postconstruct
          public void start() throws IOException {
              if (conversation.isTransient()) {
                  System.out.println("START CONVERSATION");
                  conversation.begin();
              }
                  FacesContext.getCurrentInstance().getExternalContext().dispatch("jsfpageXY.xhtml?cid="+conversation.getId());
          }


      - Open the JSF page
      - Exception is thrown:


      10:25:59,695 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/cpp].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception: org.jboss.weld.context.NonexistentConversationException: WELD-000321 No conversation found to restore for id 1
              at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:108) [:6.0.0.Final]
              at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:84) [:6.0.0.Final]
              at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:224) [:2.0.3-]
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:95) [:2.0.3-]
              at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107) [:2.0.3-]
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114) [:2.0.3-]
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308) [:2.0.3-]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.0.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.0.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.0.0.Final]
              at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.0.0.Final]
              at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542) [:2.0.3-]


      please help :-(

        • 1. Re: No Conversations at all?
          xcdemon

          Was there ever a resolution to this?   It looks like I'm experiencing the same behavior in JBoss AS 7 CR1 release where as it was not occurring in the Beta3 release.  It appears that the conversation is either being created and also disposed of even though the page is still passing the cid back with the ajax request.