8 Replies Latest reply on Mar 26, 2010 3:12 PM by ericcart

    Problem nesting JBPM BeginTask into an existing conversation

    aluduena

      Hello,


      I have a problem nesting a BeginTask annotation into a PageFlow conversation.
      The exception is:


      11:35:10,726 ERROR [SeamPhaseListener] uncaught exception
      javax.el.ELException: java.lang.IllegalStateException: begin method invoked from a long-running conversation, try using @Begin(join=true) on method: routeToPage




      The problem is that I dont have an join attribute inside the annotation @BeginTask.


      How can I solve this?


      Thanks
      Ariel

        • 1. Re: Problem nesting JBPM BeginTask into an existing conversation
          pmuir

          This isn't supported. You need to make the task the whole conversation. A task can use a pageflow.

          • 2. Re: Problem nesting JBPM BeginTask into an existing conversation
            aluduena

            Thanks Pete, but this doesnt work. The problem is in the ConversationInterceptor class in isMissingJoin method.



            private boolean isMissingJoin(Method method) {
                   return Manager.instance().isLongRunningConversation() && ( 
                         ( 
                               method.isAnnotationPresent(Begin.class) && 
                               !method.getAnnotation(Begin.class).join() && 
                               !method.getAnnotation(Begin.class).nested() 
                         ) ||
                         method.isAnnotationPresent(BeginTask.class) ||
                         method.isAnnotationPresent(StartTask.class) 
                      );
                }
            
            if ( isMissingJoin(method) )
                   {
                      throw new IllegalStateException("begin method invoked from a long running conversation, try using @Begin(join=true)");
                   }



                 
                 
            This implementation does not consider the fact that BeginTask and StartTask annotations can be used within an existing conversation.


            Therefore, it is not possible to start a JBPM Task within a PageFlow. This is correct? This is not an important limiting factor?


            Thanks


            Ariel


            • 3. Re: Problem nesting JBPM BeginTask into an existing conversation
              pmuir

              Ariel Ludueña wrote on Mar 20, 2008 05:12 AM:

                   
                   
              This implementation does not consider the fact that BeginTask and StartTask annotations can be used within an existing conversation.


              They can't, that is what I was saying ;-)


              You could file a feature request in JIRA, but I don't know if it's possible or not to support this.

              • 4. Re: Problem nesting JBPM BeginTask into an existing conversation
                aluduena

                :) Ok Pete, I will try to put this in JIRA..


                thanks for your help
                Ariel

                • 5. Re: Problem nesting JBPM BeginTask into an existing conversation
                  yagiz.yagiz.mobilus.com.tr

                  Ariel Ludueña wrote on Mar 25, 2008 14:13:


                  :) Ok Pete, I will try to put this in JIRA..

                  thanks for your help
                  Ariel


                  Is there any development about this?  I checked JIRA, but couldn't find the relevant bug.


                  --
                  Yagiz

                  • 6. Re: Problem nesting JBPM BeginTask into an existing conversation
                    sunilsu

                    We removed the @BeginTask annotation and are just calling


                    BusinessProcess.instance().resumeTask(taskId).

                    in the method that begins the task. This seems to be working...

                    • 7. Re: Problem nesting JBPM BeginTask into an existing conversation
                      balazska

                      Did it really work?

                      • 8. Re: Problem nesting JBPM BeginTask into an existing conversation

                        Yes, it works.


                        @Name("docTaskManagement")
                        public class DocTaskManagement {
                             @Logger private Log log;
                             
                             @RequestParameter("selectedTransition")
                             String selectedTransition;
                             
                             @RequestParameter("taskId")
                             Long taskId;
                             
                             public void doTheTask() {
                                  log.info("doTheTask #0", selectedTransition);          
                                  BusinessProcess bp = BusinessProcess.instance();
                                  
                                  if (bp == null) log.error("BusinessProcess null!");
                                  if (taskId == null) log.error("taskId null!");
                                  
                                  bp.resumeTask(taskId);
                                  bp.endTask(selectedTransition);
                             }     
                        
                        }
                        



                        The status of jbpm-seam implementation is very tricky indeed. You have to sort out the scopes, triggers, and variable injections.... and sometimes the jbpm process errors are hidden at the debug level.



                        Thanks,
                        Eric