4 Replies Latest reply on Apr 22, 2010 2:14 AM by cbensemann

    Error Starting Taks With Jbpm

    edier

      Hello,


      I'm working with a Seam project and recently I needed to add jbpm process definitios to it. so I refered to the example TodoList, the matter is that I have followed the steps to confiugred the project. The process is created correctly with a warn:


      "Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks =="
      



      When i want to start or end a task I get an error on the application, but on the console (or log) it shown nothing, so I don't know what happens. Here is my code:



      I have three methods in the bean:



           
      @Name("tareaEnrolamientoBB")
      @Scope(ScopeType.SESSION)
      public class TareaEnrolamientoBB extends GestionTekBackingBean {
      
           private static final long serialVersionUID = -922289055419074L;
      
           @Logger
           private Log log;
           
           @PostConstruct
           public void constructor() {
                System.out.println("===== ENTER CONSTRUCTOR ====");
           }
              @CreateProcess(definition="enrolamiento")
           public void iniciarProceso(){
           }
      
           @EndTask
           public String completarTarea() {
                  return null;
      
           }
           
           @StartTask
           public String empezarTarea(){
           return null;
           }





      and in the view:




      <h:dataTable
                               value="#{taskInstanceList}" var="task"
                               rendered="#{not empty taskInstanceList}">
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Description" />
                                    </f:facet>
                                    <h:inputText value="#{task.description}" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Created" />
                                    </f:facet>
                                    <h:outputText
                                         value="#{task.taskMgmtInstance.processInstance.start}">
                                         <f:convertDateTime type="date" />
                                    </h:outputText>
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Priority" />
                                    </f:facet>
                                    <h:inputText value="#{task.priority}" style="width: 30" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Due Date" />
                                    </f:facet>
                                    <h:inputText value="#{task.dueDate}" style="width: 100">
                                         <f:convertDateTime type="date" dateStyle="short" />
                                    </h:inputText>
                               </h:column>
                               <h:column>
                                    <s:link value="Start" action="#{tareaEnrolamientoBB.empezarTarea}"
                                         taskInstance="#{task}" linkStyle="button" />
                               </h:column>
                               <h:column>
                                    <s:link value="Done" action="#{tareaEnrolamientoBB.completarTarea}"
                                         taskInstance="#{task}" linkStyle="button" />
                               </h:column>
                          </h:dataTable>



      the button for starting process:



      <h:commandButton action="#{tareaEnrolamientoBB.iniciarProceso}"
                               styleClass="btnNaranja" value="Registrar" />




      ANY HELP WELCOMED!!!! THANKS!!


        • 1. Re: Error Starting Taks With Jbpm
          edier

          I've been trying to solve the problem... I replaced


          <s:link value="Start" action="#{tareaEnrolamientoBB.empezarTarea}"
               taskInstance="#{task}" linkStyle="button" />



          for


          <h:commandLink action="#{tareaEnrolamientoBB.empezarTarea}" value="Start(h)">
               <f:param name="taskId" value="#{task.id}" />
          </h:commandLink>



          And now I got this error:


          java.lang.IllegalStateException: begin method invoked from a long-running conversation, try using @Begin(join=true) on method: empezarTarea



          So, I use @Begin anotattion on the method, but the error still is the same!!!


          If any can help, I Thank You!!!

          • 2. Re: Error Starting Taks With Jbpm
            cbensemann

            I also had a few problems getting Jbpm to do what I wanted to start with. Not sure exactly what your problem is. Can you post your pages.xml? When you said you used @Begin do you mean you used @Begin(join="true")? Also did you know you can use <s:taskId value="#{task.id}" /> instead of f:param? It shouldn't make any difference to the working though.

            • 3. Re: Error Starting Taks With Jbpm
              edier

              My pages.xml is so big, so it's a little dificult post it. The extraordinary things in it are:




              <?xml version="1.0" encoding="UTF-8"?>
              <pages xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd"
              
                   no-conversation-view-id="/common/mainPages/home.xhtml" login-view-id="/common/mainPages/home.xhtml">
              
                   <!-- ============================= common pages ================== -->
                   <!-- after login go to main page -->
                   <page view-id="/common/mainPages/home.xhtml">
                        <navigation>
                             <rule if="#{identity.loggedIn}">
                                  <redirect view-id="/common/mainPages/main.xhtml" />
                             </rule>
                        </navigation>
                   </page>
              
                   <!--  before main page execute action #{login.login} -->
                   <page view-id="/common/mainPages/main.xhtml" login-required="true">
                        <action execute="#{login.login}" if="#{! login.loggedIn}" />
                        <navigation>
                             <redirect view-id="/supercade/tramites/FormInitEnrolamiento.xhtml">
                                  <!--      <param value="begin" name="conversationPropagation" /> -->
                             </redirect>
                        </navigation>
                        <!--
                             <navigation> <rule if="#{identity.hasRole('Ciudadano')}"> <redirect
                             view-id="/supercade/workflow/MisTramites.xhtml" /> </rule> <rule
                             if="#{identity.hasRole('Funcionario')}"> <redirect
                             view-id="/supercade/workflow/FuncionarioStoryBoard.xhtml" /> </rule>
                             </navigation>
                        -->
                   </page>





              On the other hand



              When you said you used @Begin do you mean you used @Begin(join="true")?



              Yes I meant @Begin(join="true").


              The problem is that when I click on the link that invoke the method with the @StartTask annotation, it shows the error


              java.lang.IllegalStateException: begin method invoked from a long-running conversation, try using @Begin(join=true) on method: empezarTarea



              I also tried to use the attibute id="#{conversation.id}"  in the @StartTask annotation, but it didn't works.


              I also tried to invoke the method this way:


              <h:commandLink action="#{tareaEnrolamientoBB.empezarTarea}" value="Start(h)">
                   <f:param name="conversationPropagation" value="join" />
                   <f:param name="taskId" value="#{task.id}" />
              </h:commandLink>



              I didn't get the error, but the task neither started!


              Finally, I noticed some diference between the examples and my project, in mine the console shows the followin warn every time the method with @CreateProcess o @StartTask is invoked:


              [ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.TaskNode - this operation breaks ==



              Hope i make understand...

              • 4. Re: Error Starting Taks With Jbpm
                cbensemann

                I also get the Narrowing proxy warning and have never looked into why it happens but my processes are still working ok even with this so dont think thats the problem. @BeginTask and @StartTask also create a long running conversation I believe. I'm not sure from your code but are you already in a conversation when you attempt to start the task? I think this may be your problem.