[jboss-user] [jBPM] - in jbpm 4.3, timer's event listener throws exception on ExecuteEventListener.java:68.

Tun Mang do-not-reply at jboss.com
Wed Jul 28 20:15:28 EDT 2010


Tun Mang [http://community.jboss.org/people/tunmang] created the discussion

"in jbpm 4.3, timer's event listener throws exception on ExecuteEventListener.java:68."

To view the discussion, visit: http://community.jboss.org/message/554894#554894

--------------------------------------------------------------
Hi there,

Follow the example described in "jbpm-4.3/doc/devguide/html_single/index.html#timer", the following is what we have done:

    (1) in the event listener, we call executeJob:

  public void notify(EventListenerExecution execution)
  {   
    String aId   = execution.getId();
    String aName = execution.getName();    
    out("===============================");
    out("timer handler: (timeout) event (" + aId + ").");
    out("===============================");
    ProcessInstance processInstance = (ProcessInstance) execution.getProcessInstance();    
    ManagementService managementService = EnvironmentImpl.getFromCurrent(ManagementService.class);    
    JobQuery jobQuery = managementService.createJobQuery();    
    JobQuery timerQuery = jobQuery.timers();    
    JobQuery ptQuery = timerQuery.processInstanceId( processInstance.getId() );
    
    List<Job> jobList = ptQuery.list();    
    Job foundJob = null;      
    for(int ii=0 ; ii < jobList.size(); ii++)
    {
      Job jbpmJob = jobList.get(ii);          
      Execution jobExcu = jbpmJob.getExecution();     
      String bId   = jobExcu.getId();
      String bName = jobExcu.getName();      
      if( ! bId.equals(aId) || ! bName.equals(aName) )
        continue;           
      foundJob = jbpmJob;
      break;
    }
    
    if( foundJob == null )
    {
      err("cannot find a matched timer object in external db: (execId: " + aId + "), (name: " + aName + ").");
      return;
    }
    out("found a matched timer object in external db: (execId: " + aId + "), (name: " + aName + "), (timerId: " + foundJob.getId() + ").");       
    managementService.executeJob( foundJob.getId() );   
  }
 
  (2) in the process definition, we linked it with the timer:
 
    <state g="222,123,147,40" name="generate-file">
      <on event="timeout">
        <timer duedate="10 seconds"/>
       <event-listener class="basicfive.TestTimerHandler">
          <field name="msg"><string value="entered the (generate-file) state node."/></field>
        </event-listener>   
      </on> 
      <on event="start">
         <event-listener class="basicfive.TestJobMakeRequestHandler">
          <field name="msg"><string value="entered the (generate-file) state node."/></field>
        </event-listener>   
      </on> 
      <transition g="-71,-15" name="timeout" to="remove-file">        
      </transition>           
   </state>

  (3) When start the process instance, and after it reaches the handler, it always throws the following exeptions:

10-07-28/17:01:17 DEBUG [basicfive.TestTimerHandler]: (AP) ===============================
10-07-28/17:01:17 DEBUG [basicfive.TestTimerHandler]: (AP) timer handler: (timeout) event (test_Timer_1.680001.generate-file).
10-07-28/17:01:17 DEBUG [basicfive.TestTimerHandler]: (AP) ===============================
10-07-28/17:01:17 DEBUG [basicfive.TestTimerHandler]: (AP) found a matched timer object in external db: (execId: test_Timer_1.680001.generate-file), (name: generate-file), (timerId: 680004).
10-07-28/17:01:17 DEBUG [basicfive.TestTimerHandler]: (AP) leaving event fired for timer object in external db: (id: test_Timer_1.680001.generate-file), (name: generate-file).
### EXCEPTION ###########################################
17:01:17,161 SEV       | [ExecuteJobCmd] exception while executing 'timer[680004|2010-07-28 17:01:15,000|timeout]'
java.lang.NullPointerException
 at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:68)
 at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:678)
 at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:638)
 at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:585)
 at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:575)
......


How do we resolve this problem ? Thanks a lot for your help in advance.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/554894#554894]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100728/4d451a8a/attachment-0001.html 


More information about the jboss-user mailing list