[jboss-user] [JBoss jBPM] - Error in executing jbpm code

AjayKamath7 do-not-reply at jboss.com
Tue Dec 23 07:35:21 EST 2008


i am runing below code code for Jbpm 

package com.sample.action;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.jbpm.graph.def.ProcessDefinition;   
import org.jbpm.graph.exe.ProcessInstance;   
import org.jbpm.graph.exe.Token;
import org.jbpm.taskmgmt.def.Task;
import org.jbpm.taskmgmt.exe.TaskInstance; 

public class TestWorkflow {

	public static void main(String args[])throws Exception {   
		  new TestWorkflow().execute();   
		 }   
	
	public void execute() throws Exception {   
//		 Extract process from the processdefinition.xml file.   
		  ProcessDefinition processDefinition =ProcessDefinition.parseXmlResource("NewSample/processdefinition.xml");  
		  ProcessInstance instance =new ProcessInstance(processDefinition);
		  
		  
		  displayStatus(instance);   
		  instance.signal();
		  
		  displayStatus(instance);   
		  executeTask(instance);
		  
		  
		  displayStatus(instance);   
		  executeTask(instance);
		  
		  displayStatus(instance);   
         
         
	}	  
	 
	   private void displayStatus(ProcessInstance instance) {   
		 
		  
		   String nodeName = instance.getRootToken().getNode().getName();   
		   System.out.println("task node executed: "+nodeName);  
		 
		}   
	   
	   private void executeTask(ProcessInstance instance) {   
		   
//		 Get the Task Instance List
			ArrayList taskList = new ArrayList(instance.getTaskMgmtInstance().getTaskInstances());
			System.out.println("length" +taskList.size());
	        Iterator iter = taskList.iterator();   
		 
		   while (iter.hasNext()) {   
			   
		    TaskInstance taskInstance = (TaskInstance)iter.next();   
		    
		    System.out.println("Found Task "+taskInstance.getName());   
		    System.out.println("Found Actor "+taskInstance.getActorId());     
		    
		    taskInstance.end();   
		    System.out.println("Task completed");   
		    		   }   
		            
		  }   
		
         	  
          
}   
i am getting the following error 
Exception in thread "main" java.lang.IllegalStateException: task instance '0' is already ended

pls help...

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4198271#4198271

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4198271



More information about the jboss-user mailing list