0 Replies Latest reply on Aug 24, 2005 12:47 PM by Ivan Noboa

    Problem moving from one state to other

    Ivan Noboa Newbie

      I'm having a problem moving from a state to other, this is my handler:


      public final void remindActor(ActionMapping mapping, ec.gov.sri.websaleSample.presentation_layer.web_sale.RemindActorForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
      {

      //create session factory
      System.out.println("\n\n\n ****** ===> Create Session Factory" );
      final org.jbpm.db.JbpmSessionFactory SESSION_FACTORY = org.jbpm.db.JbpmSessionFactory.buildJbpmSessionFactory();

      //inject process definition (only once)
      //final org.jbpm.graph.def.ProcessDefinition websaleUseCaseDefinition =
      // org.jbpm.graph.def.ProcessDefinition.parseXmlResource("ec/gov/sri/websaleSample/presentation_layer/web_sale/websale-use-case.pdl.xml");

      //final org.jbpm.db.JbpmSession session = SESSION_FACTORY.openJbpmSession();
      //final org.jbpm.db.GraphSession graphSession = session.getGraphSession();

      //session.beginTransaction();
      //graphSession.saveProcessDefinition(websaleUseCaseDefinition);
      //session.commitTransactionAndClose();

      System.out.println("\n\n\n ****** ===> Create Session " );
      final org.jbpm.db.JbpmSession session = SESSION_FACTORY.openJbpmSession();

      System.out.println("\n\n\n ****** ===> Begin Transaction" );
      session.beginTransaction() ;

      System.out.println("\n\n\n ****** ===> Process Definition" );
      org.jbpm.graph.def.ProcessDefinition remindActorProcess = session.getGraphSession().findLatestProcessDefinition("websaleUseCase") ;
      System.out.println("\n\n\n ****** ===> Process Instance" );
      org.jbpm.graph.exe.ProcessInstance remindActorInstance = new org.jbpm.graph.exe.ProcessInstance(remindActorProcess);

      System.out.println("\n\n\n ****** ===> Token" );
      org.jbpm.graph.exe.Token token = remindActorInstance.getRootToken();

      System.out.println("\n\n\n ****** ===> Token.signal() previous" );
      token. signal() ;
      System.out.println("\n\n\n ****** ===> Token.signal() post" );

      System.out.println("\n\n\n ****** ===> Save Process Instance" );
      session.getGraphSession().saveProcessInstance(remindActorInstance) ;

      System.out.println("\n\n\n ****** ===> Commit" );
      session.commitTransaction() ;

      System.out.println("\n\n\n ****** ===> Close" );
      session.close();
      }


      but when I send token.signal() I got this message :

      DEBUG [org.jbpm.graph.def.GraphElement] executing action 'action[sendWebOrder]'
      [org.jbpm.graph.def.GraphElement] action threw exception: null
      java.lang.NullPointerException
      at org.jbpm.graph.def.Action.execute(Action.java:78)
      at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:186)


      this is the process definition :

      <process-definition name="websaleUseCase">
      
       <start-state name="create new web sale order" swimlane="buyer">
       <transition name="WebSale begin" to="get User Order"/>
       </start-state>
      
       <swimlane name="buyer">
       <assignment class="ec.gov.sri.websaleSample.presentation_layer.web_sale.BuyerAssignmentImpl"/>
       </swimlane>
      
       <swimlane name="salesman">
       <assignment expression="user=(ernie)"/>
       </swimlane>
      
       <swimlane name="accountant">
       <assignment expression="user=(bert)"/>
       </swimlane>
      
       <swimlane name="shipper">
       <assignment expression="user=(grover)"/>
       </swimlane>
      
       <node name="get User Order">
       <transition name="send web order" to="evaluate Web Order">
       <action name="sendWebOrder"/>
       </transition>
       <transition name="Main Menu" to="mainEntry">
       <action name="MainMenu"/>
       </transition>
       </node>
      
       <node name="fix Web Order Data">
       <transition name="info complete" to="evaluate Web Order">
       <action name="infocomplete"/>
       </transition>
       </node>
      
       <node name="info review">
       <transition name="incomplete" to="more info needed in">
       <action name="incomplete"/>
       </transition>
       <transition name="complete" to="mainEntry">
       <action name="complete"/>
       </transition>
       </node>
      
       <node name="more info needed in">
       <transition name="fix data" to="fix Web Order Data">
       <action name="fixdata"/>
       </transition>
       <timer name="complete info" duedate="20 seconds" repeat="10 seconds">
       <action name="complete info" class="ec.gov.sri.websaleSample.presentation_layer.web_sale.MoreInfoNeededImpl"/>
       </timer>
       </node>
      
       <end-state name="mainEntry"/>
      
       <task-node name="evaluate Web Order" signal="never" create-tasks="true">
       <task name="remindActor" swimlane="salesman" blocking="true">
       <controller>
       <variable name="item" access="required,read"/>
       <variable name="quantity" access="required,read"/>
       <variable name="address" access="required,read"/>
       </controller>
       </task>
       <transition name="evaluate Web Order" to="info review">
       <action name="evaluateWebOrder"/>
       </transition>
       </task-node>
      
      
      </process-definition>


      What I'm doing wrong, because I can see the System.out.println("\n\n\n ****** ===> Token.signal() previous" ); message but after that fails with the message above.