1 2 Previous Next 21 Replies Latest reply on Nov 8, 2007 5:51 PM by Gus Gu

    Why cannot I run more than one concurrent conversation SFSB

    Gus Gu Expert

      Hi all,

      I am very frustrated by my conversation problem. I don't know where is wrong in my project settings. It seems that my environment only allows one conversation exist concurrently. For example, after I click @Begin to create a conversation SFSB, then when I try to click @Begin to start another conversation SFSB, I ALWAYS get an exception, which asks me to use @Begin(join=true), but they are two different conversation SFSBs. Following are my codes:

      First, I use a conversation SFSB to find study list:

      <h:commandButton value="List Study" action="#{studyList.findStudy}"/>
      
      
      @Stateful
      @Scope(CONVERSATION)
      @Name("studyList")
      public class StudyListAction implements StudyList {
      
       ...
       @Create
       @Begin
       public init() {
       ...
       }
      
       @Begin(join=true)
       public String findStudy {
       ...
       }
      
       ...
      }

      Then I try to create a new study at "Create Study":
      <h:commandLink value="Create Study" action="#{studyEditor.createInstance}"/>
      
      
      @Stateful
      @Scope(CONVERSATION)
      @Name("studyEditor")
      public class StudyEditorBean implements StudyEditor {
      
       ...
      
       @Begin
       public String createInstance {
       ...
       }
      
      
       ...
      }

      At this moment, I always get the following exception:
      21:53:43,203 FATAL [application] javax.ejb.EJBTransactionRolledbackException: begin method invoked from a long running conversation, try using @Begin(join=true) on method: createInstance
      javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: begin method invoked from a long running conversation, try using @Begin(join=true) on method: createInstance
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
       at javax.faces.component.UICommand.broadcast(UICommand.java:383)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
       at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:57)
       at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:45)
       at com.icesoft.faces.webapp.http.core.IDVerifier.service(IDVerifier.java:25)
       at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:52)
       at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
       at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
       at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
       at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
       at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
       at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
       at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
       at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
       at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
       at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:54)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      ...........

      Any help will be very very appreciated. Thank you soooo much in advance.

        • 1. Re: Why cannot I run more than one concurrent conversation S
          Jacob Orshalick Apprentice

          This is correct behavior since if you are in a long-running conversation, you can only join that conversation or nest another conversation. Nesting may be a good option if you want to have the potential for multiple conversations within the parent conversation.

          If nesting is not appropriate, you can leave the current conversation with conversationPropagation="none". If you are using facelets, this can be accomplished by:

          <h:commandButton value="List Study" action="#{studyList.findStudy}">
           <s:conversationPropagation propagation="none"/>
          </h:commanButton>


          • 2. Re: Why cannot I run more than one concurrent conversation S
            Gus Gu Expert

            Hi Jacob,

            Thank you very much for your quick reply. I am still confused about the long-running conversation. You means that, if I start a long-running conversation SFSB, I cannot start another long-running conversation SFSB unless I @End the first one or @Begin(nested=true) to start a nested one?

            • 3. Re: Why cannot I run more than one concurrent conversation S
              Jacob Orshalick Apprentice

              You can, you simply have to specify not to propagate the long-running conversation as I said before. You will remain in the same long-running conversation across requests unless you specify propagation=none (there are other ways as well, but this is the general approach). So if you remain in a long-running conversation (which you will be unless you say not to propagate), you can only join that conversation, nest, or end it.

              If you do not propagate the conversation, you can still return to the other conversation (by back-buttoning or workspace switching). Hope that helps.

              • 4. Re: Why cannot I run more than one concurrent conversation S
                Gus Gu Expert

                Hi Jacob,

                This time I got a little clear, but I still don't know how to use it in my following code. In my previous studyList, the more codes like this: (I think this is typical search bean)

                @Stateful
                @Scope(CONVERSATION)
                @Name("studyList")
                public class StudyListAction implements StudyList {
                
                 ...
                 @Create
                 @Begin
                 public init() {
                 ...
                 }
                
                 @Begin(join=true)
                 public String findStudy {
                 ...
                 }
                
                 @Begin(join=true)
                 public void nextPage() {
                 ...
                 }
                
                 @Begin(join=true)
                 public void previousPage() {
                 ...
                 }
                
                 @Begin(join=true)
                 public void firstPage() {
                 ...
                 }
                
                 @Begin(join=true)
                 public void lastPage() {
                 ...
                 }
                
                 ...
                }

                Should I use <s:conversationPropagation propagation="none"/> in each method? Like this:
                <h:commandButton value="List Study" action="#{studyList.findStudy}">
                 <s:conversationPropagation propagation="none"/>
                </h:commanButton>
                
                <h:commandButton value="Next Page" action="#{studyList.nextPage}">
                 <s:conversationPropagation propagation="none"/>
                </h:commanButton>
                
                <h:commandButton value="Last Page" action="#{studyList.lastPage}">
                 <s:conversationPropagation propagation="none"/>
                </h:commanButton>
                
                ......
                

                Thank you for any help!

                • 5. Re: Why cannot I run more than one concurrent conversation S
                  Jacob Orshalick Apprentice

                  No, you would not want to do something like that. I think looking at an example might help...

                  Take a look at the seam-booking example that ships with Seam. Review main.xhtml and book.xhtml as well as the actions they use to see how conversations are started and ended. Then look at the template.xhtml to see how propagation=none can be used when you are in a long-running conversation.

                  • 6. Re: Why cannot I run more than one concurrent conversation S
                    Gus Gu Expert

                    Thank you very much, Jacob.

                    • 7. Re: Why cannot I run more than one concurrent conversation S
                      Gus Gu Expert

                      Can any other experts give me a help? I have this problem for a while. I really don't know why my system allows only one concurrent long-running conversation. When I try to @Begin another long-running conversation, my system always ask for @Begin with "join=true". From Seam coversationList, it should allow several long-running conversations, and also it can switch to other one. My settings have some problem? or I misunderstood Seam long-running conversation? My codes above is very typical for CRUD, I think. Thank you so much in advance!

                      • 8. Re: Why cannot I run more than one concurrent conversation S
                        Pete Muir Master

                        You can only have one foreground/active long running conversation per browser window.

                        • 9. Re: Why cannot I run more than one concurrent conversation S
                          Gus Gu Expert

                           

                          "pete.muir@jboss.org" wrote:
                          You can only have one foreground/active long running conversation per browser window.

                          Hi Pete,

                          Thank you so much for your reply, but I really couldn't figure out how to set current foreground/active long running conversation to background/inactive, and create a new foreground/active long running conversation. What I got was either join to previous conversation, or exception of require @Begin(join=true). I think it may be a bug. Any suggestion will be very appreciated. Thanks Pete.

                          • 10. Re: Why cannot I run more than one concurrent conversation S
                            Curtney Jacobs Newbie

                            Well, I am certainly not an expert, I got my own share of problems. But, I believe what Pete and Jacob are saying is that in other for you to start another conversation (concurrent one) you would need to

                            leave the current conversation with conversationPropagation="none".


                            effectively leaving the current/active conversation (not ending it). You can then proceed to create another conversation.

                            In other words, you have four options:
                            1) join
                            2) nest
                            3)propagation none ****** This is the one you want *********
                            4)end

                            correct me if I am wrong guys

                            • 12. Re: Why cannot I run more than one concurrent conversation S
                              Gus Gu Expert

                               

                              "curtney" wrote:

                              effectively leaving the current/active conversation (not ending it). You can then proceed to create another conversation.

                              In other words, you have four options:
                              1) join
                              2) nest
                              3)propagation none ****** This is the one you want *********
                              4)end

                              correct me if I am wrong guys

                              Hi Guys,

                              I am totally confused by the conversation style. For a programmer, he designs a conversation, e.g. place an order: a long running conversation - "start, join, join, nest, join, end-nest, end". When a user use it, he may propagate the whole process and finish a long conversation, or he may stop at any step (he may not click cancel), then browse to another long-running conversation. Definitely, a user cannot add a "propagation-none" code to a step which he stopped. At this situation, can a developer guess which step a user may stop? then add a "propagation-none"? Sorry, I am totally lost.

                              • 13. Re: Why cannot I run more than one concurrent conversation S
                                Pete Muir Master

                                The programmer would make the navigation link he clicks propagation="none"

                                • 14. Re: Why cannot I run more than one concurrent conversation S
                                  Gus Gu Expert

                                   

                                  "pete.muir@jboss.org" wrote:
                                  The programmer would make the navigation link he clicks propagation="none"

                                  Hi Pete,

                                  Thank you very much for your replies on my several Conversation discussion post. Could you please give me a details instruction in the following codes which I modified from the booking example? I changed the HotelSearch bean from Session to Conversation. Thank you so much in advance.
                                  HotelSearch.java
                                  @Stateful
                                  @Name("hotelSearch")
                                  @Scope(ScopeType.CONVERSATION)
                                  @Restrict("#{identity.loggedIn}")
                                  public class HotelSearchingAction implements HotelSearching {
                                   ...
                                  
                                   @Begin
                                   public void find() {
                                   page = 0;
                                   queryHotels();
                                   }
                                  
                                   @Begin(join=true)
                                   public void nextPage() {
                                   page++;
                                   queryHotels();
                                   }
                                  
                                   @Begin(join=true)
                                   public void previousPage() {
                                   page--;
                                   queryHotels();
                                   }
                                  
                                   private void queryHotels() {
                                   ...
                                   }
                                  
                                   @Remove
                                   public void destroy() {}
                                  }
                                  

                                  HotelBooking.java
                                  @Stateful
                                  @Name("hotelBooking")
                                  @Scope(ScopeType.CONVERSATION)
                                  @Restrict("#{identity.loggedIn}")
                                  public class HotelBookingAction implements HotelBooking {
                                  
                                   @Begin
                                   public void selectHotel(Hotel selectedHotel) {
                                   ...
                                   }
                                  
                                   public void bookHotel() {
                                   ...
                                   }
                                  
                                   public void setBookingDetails() {
                                   ...
                                   }
                                  
                                   @End
                                   public void confirm() {
                                   ...
                                   }
                                  
                                   @End
                                   public void cancel() {}
                                  
                                   @Remove
                                   public void destroy() {}
                                  }

                                  and main.xhtml
                                  <h:selectInputText id="searchString" />
                                  <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" />
                                  
                                  <h:dataTable id="hotels" value="#{hotels}" var="hot" >
                                   ...
                                   <h:column>
                                   <f:facet name="header">Action</f:facet>
                                   <ice:commandLink id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
                                   </h:column>
                                  </h:dataTable>
                                  
                                  <h:commandLink value="Next Page" action="#{hotelSearch.nextPage}"/>
                                  <h:commandLink value="Previous Page" action="#{hotelSearch.previousPage}"/>


                                  1 2 Previous Next