11 Replies Latest reply on Jan 11, 2007 5:20 PM by Juan Giovanolli

    Help me in Moving a State from one task to another

    Susant Patnaik Newbie

      Hi All,
      I have a problem for moving one state to another.
      i have the following processdefinition.xml but i guess there is some problem in jboss forum to display xml files

      ################################################
      <?xml version="1.0" encoding="UTF-8"?>

      <process-definition name="Schedule process">



      actor1


      actor2


      actor3



      <!-- START-STATE -->
      <start-state name="Start Some process" swimlane="actor2">

      </start-state>





      <!-- DECISION -->





      <!-- NODE -->





      <!-- NODE -->











      <!-- END-STATE -->
      <end-state name="done" />

      </process-definition>



      ################################################



      Here by following api i am trying to start a process and moving the state from one to another.

      so i have written the following code correct if i am wrong.

      Starting a process
      jbpmSession = jbpmSessionFactory.openJbpmSession();
      ProcessDefinition processDefinition = jbpmSession.getGraphSession().findLatestProcessDefinition(strProcDef);
      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      Token token = processInstance.getRootToken();
      System.out.println("token.getnode.name : "+token.getNode().getName());
      token.signal();
      jbpmSession.close();

      Please give me some input if i have missed any thing.

        • 2. Re: Help me in Moving a State from one task to another
          brittm Novice

          Susant,

          Most likely, no one will be able to help you until you successfully post your process definition.

          -Britt

          • 3. Re: Help me in Moving a State from one task to another
            Ronald van Kuijk Master

            Agreed, and pinging it to get it at the top of the list to give it more attention doesn't either. Could even have the opposite result.

            • 4. Re: Help me in Moving a State from one task to another
              Susant Patnaik Newbie

              Ronald : I am sorry to type ping .
              Britt : yaa i tried to paste my processdefinition but here it is not perfectly coming some data are truncated in the browser .
              i have pasted the xml file in the following link
              https://sourceforge.net/forum/forum.php?thread_id=1328596&forum_id=240085

              Please have a look.
              Thanks in Advance,
              Susant

              • 5. Re: Help me in Moving a State from one task to another
                Susant Patnaik Newbie

                 

                "susant" wrote:
                Ronald : I am sorry to type ping .
                Britt : yaa i tried to paste my processdefinition but here it is not perfectly coming some data are truncated in the browser .
                i have pasted the xml file in the following link
                https://sourceforge.net/forum/forum.php?thread_id=1328596&forum_id=240085

                Please have a look.
                Thanks in Advance,
                Susant


                • 6. Re: Help me in Moving a State from one task to another
                  Ronald van Kuijk Master

                  the thread at the sf forum is removed. Post it here and surround it by a 'code' tag:

                  <ROOT><ELEMENT ATTIBUTE="value">TEXT</ELEMENT></ROOT>


                  • 7. Re: Help me in Moving a State from one task to another
                    Susant Patnaik Newbie

                    yaa thanks Ronal for helping me to put the xml file by using code tag.
                    so here is the xml file.
                    i am trying to move from startstate to another state

                    <?xml version="1.0" encoding="UTF-8"?>
                    
                    <process-definition name="Schedule process">
                    
                    <!-- SWIMLANES -->
                    <swimlane name="Legal-Reviewer" >
                    <delegation class="com.test.hndlrs.assignment.AssignmentHandler1">Legal-Reviewer</delegation>
                    </swimlane>
                    <swimlane name="Record-Coordinator">
                    <delegation class="com.test.hndlrs.assignment.AssignmentHandler2">Record-Coordinator</delegation>
                    </swimlane>
                    <swimlane name ="Corporate-Councilor">
                    <delegation class="com.test.hndlrs.assignment.AssignmentHandler3">Corporate-Councilor</delegation>
                    </swimlane>
                    
                    
                    <!-- START-STATE -->
                    <start-state name="Start Schedule process" swimlane="Record-Coordinator">
                    <transition name="step0" to="Approval-1 Of Schedule"/>
                    </start-state>
                    <state name="Approval-1 Of Schedule">
                    <assignment swimlane="Legal-Reviewer" />
                    <transition name="step1" to="decision1"/>
                    </state>
                    
                    <!-- DECISION -->
                    <decision name="decision1" >
                    <delegation class="com.test.hndlrs.decision.DecisionHandler1" />
                    <transition name="approved" to="Approval-2 Of Schedule" />
                    <transition name="disapproved" to="Modify Schedule" />
                    </decision>
                    <!-- NODE -->
                    <state name="Modify Schedule">
                    <assignment swimlane="Record-Coordinator" />
                    <transition name="step2" to="Approval-1 Of Schedule"/>
                    </state>
                    
                    <!-- NODE -->
                    <state name="Approval-2 Of Schedule">
                    <assignment swimlane="Corporate-Councilor" />
                    <transition name="step3" to="decision2"/>
                    </state>
                    
                    <decision name="decision2" >
                    <delegation class="com.test.hndlrs.decision.DecisionHandler2" />
                    <transition name="approved" to="done" />
                    <transition name="disapproved" to="Modify Schedule" />
                    </decision>
                    
                    <!-- END-STATE -->
                    <end-state name="done" />
                    
                    </process-definition>



                    the error i am facing like this here what should i do
                    token.signal or processinstance.signal to move the state.

                    ***********************************************
                    java.lang.NullPointerException
                     at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
                     at java.security.AccessController.doPrivileged(Native Method)
                     at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
                     at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
                     at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
                     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
                     at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
                     at org.jbpm.instantiation.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:16)
                     at org.jbpm.taskmgmt.exe.TaskMgmtInstance.getTaskInstanceClass(TaskMgmtInstance.java:41)
                     at org.jbpm.taskmgmt.exe.TaskMgmtInstance.instantiateNewTaskInstance(TaskMgmtInstance.java:174)
                     at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:74)
                     at org.jbpm.graph.node.TaskNode.execute(TaskNode.java:136)
                     at org.jbpm.graph.def.Node.enter(Node.java:284)
                     at org.jbpm.graph.def.Transition.take(Transition.java:92)
                     at org.jbpm.graph.def.Node.leave(Node.java:349)
                     at org.jbpm.graph.node.StartState.leave(StartState.java:73)
                     at org.jbpm.graph.exe.Token.signal(Token.java:127)
                     at org.jbpm.graph.exe.Token.signal(Token.java:92)
                     at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:201)
                     at TestClient.startProcess(TestClient.java:39)
                     at TestClient.main(TestClient.java:111)
                    error occured in starting process : -->java.lang.NullPointerException


                    • 8. Re: Help me in Moving a State from one task to another
                      Alejandro Guizar Master

                      TaskMgmtInstance.java:41 tries to load the task instance class. The name of this class is the value of property "jbpm.task.instance.class" in your jbpm.properties. You can see the actual value jBPM is using by looking for this entry in your log output:

                      2005-08-02 12:19:48,596 DEBUG [org.jbpm.JbpmConfiguration] jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance

                      What value do you see? My guess is that there is no such entry or that jBPM can't find the jbpm.properties file at all.

                      • 9. Re: Help me in Moving a State from one task to another
                        Susant Patnaik Newbie

                        Hi All,

                        Alejandro your guess is correct i have missed jbpm.task.instance.class property and i have filled as you suggested.
                        and i am able to start a state when i am using
                        processInstance.signal();
                        i have a doubt what should i do processinstance.signal() to start a state or token.signal.
                        Ronald can you please make me correct if i am missing something.

                        what should i use token or processinstance.signal.

                        like when i am using token.signal(); the error i am getting as follows

                        10:38:07,828 ERROR JbpmSession : org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.exe.Token
                        Exception is java.lang.RuntimeException: couldn't commit transaction


                        Reply will be highly appriciated,
                        Susant