6 Replies Latest reply on Apr 14, 2006 3:46 PM by gavin.king

    jBPM demarcation question

    sunfire

      I have a problem with the @StartTask annotation. I took the tasklist example as foundation. Now I have a tasklist component with this method

      @StartTask
      public String startTask() {
       return getTaskMapping(taskInstance.getName());
      }

      and it allways ends up in this exception:
      Caused by: java.lang.IllegalStateException: begin method invoked from a long running conversation, try using @Begin(join=true)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:55)
       at sun.reflect.GeneratedMethodAccessor134.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:58)
       at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:38)
       at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:66)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:38)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
       at com.broadcore.portal.task.TodoList$$EnhancerByCGLIB$$5b67fb6a.resumeTask(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
       ... 38 more

      Since the exception told me what todo I added @Begin(join=true) to the method
      @Begin(join=true)
      @StartTask
      public String startTask() {
       return getTaskMapping(taskInstance.getName());
      }
      but I still get the exact same exception.

      My seam version is from todays CVS. Any hints on what I am doing wrong or is there a bug in the ConversationInterceptor.isMissingJoin() method?

      TIA, Thorsten

        • 1. Re: jBPM demarcation question
          mirko27

          Yesterday we got same exception, but with @Begin.
          We put @Begin(join=true) to @Factory and later to @Create method(not both at same time), then the error was gone, but no conversation begun. Maybe some bug?
          Btw did you use @CreateProcess before?
          You can use tasks in process.

          • 2. Re: jBPM demarcation question
            sunfire

            We had the very same issues you describe with the @Factory method a few days ago but it went away without changeing anything and we haven't been able to reproduce - actually we haven't tried since then because time is short. ;)

            Yes we do use @CreateProcess to create an instance of the long running process. From within the jpdl there are quite a few tasks wich are being created and assigned to pooled actors. From there the poolmembers can pick tasks and assign them to themselfs. When they open the specific taskforms for the first time @StartTask is called to set the start date in the task, else @BeginTask is uesed to resume work.
            Everyting works fine except the wired behavior of @StartTask and @BeginTask.

            • 3. Re: jBPM demarcation question
              sunfire

              I had a look into the code and it seems that the exception is only throwen when there was a regular-long-running-conversation active while a method annotated with @StartTask or @BeginTask is called. The problem went away when I called a dummy @End annotated method right before the @StartTask or @BeginTask annotated methods.
              My question now: would it be possible (or even make sense for that matter) to add the "join" property to the Task* annotations? Or maybe something like @StartTask(forceNew=true) to not to join the current conversation but to gracefully clean all active conversations up and create a brand new one?

              TIA, Thorsten

              • 4. Re: jBPM demarcation question
                gavin.king

                Why do you have a conversation active when beginning a task. That does not make sense.

                • 5. Re: jBPM demarcation question
                  sunfire

                  Well this is how it happens:
                  A user starts a long running conversation somewhere in the application... doesn't matter where exactly. Before he was doing anything meaningful in the conversation a colleague jumps into his office and asks him if he could go to his tasklist and acknowledge the sales quotation he just created (acknowledging a quotation before its being sent to a potential customer by a superior is part of the workflow).
                  So he clicks on his bookmarked URL which brings up the tasklist. There he sees the task in his list and clicks on the "details" button which then would execute the @StartTask interceptor while the long running conversation is still active.
                  Since the tasklist is the point from where almost all the people get their work tasklist.jsf needs to be bookmarkable so I can't use the trick to put the @End annotation on a navigation method.
                  What is your recommendation to solve the problem?

                  • 6. Re: jBPM demarcation question
                    gavin.king

                     

                    So he clicks on his bookmarked URL which brings up the tasklist. There he sees the task in his list and clicks on the "details" button which then would execute the @StartTask interceptor while the long running conversation is still active.


                    Clicking on a URL causes a GET request, which do NOT usually propagate conversations.

                    Have you read the section of the docs which describe conversation propagation rules?