Good morning folks!

Sorry but it's me pestering the forum with my questions again. ;) I tried to 
implement a kind of 4-eyes-approval where the decisions of the 2 people can be 
made concurrently. I had trouble with this process because when I tried to 
start a new instance in the jbpm-console I did not see a new instance. 
Furthermore when I tried to view the 2 users' tasklists to check if the tasks 
had been created I got an exception:


  | org.jboss.resteasy.spi.UnhandledException: 
org.hibernate.LazyInitializationException: could not initialize proxy - no 
Session
  | 

I thought this was a bug already reported but I don't manage to find the 
matching posts and the matching issue in JIRA anymore. I was sure there was a 
thing partly related to the engine and partly related to the console. At first 
I thought it was just an issue with the console because I made a unit test for 
the process and it passed. Afterwards I was using the API of the Process Engine 
instance used by the console to go through the process without using the 
console and it did not work. Buit when the unit test passes it should run on 
the server as well (in my case Tomcat), or not?

Process definition and unit test follow. I am using jBPM 4.1 running on Tomcat 
on a Windows Server System.


  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process name="parallel" xmlns="http://jbpm.org/4.0/jpdl"; key="parallel" 
version="3">
  |    <start g="27,23,48,48" name="start1">
  |       <transition g="-49,-21" name="to fork1" to="fork1"/>
  |    </start>
  |    <end ends="process-instance" g="252,226,48,48" name="end1"/>
  |    <fork g="173,22,48,48" name="fork1">
  |       <transition g="-50,-21" name="to task1" to="task1"/>
  |       <transition g="8,-21" name="to task2" to="task2"/>
  |    </fork>
  |    <task assignee="mike" g="76,121,92,52" name="task1">
  |       <transition g="-35,-41" name="no" to="end1"/>
  |       <transition g="-39,-11" name="yes" to="join1"/>
  |    </task>
  |    <task assignee="peter" g="228,122,92,52" name="task2">
  |       <transition g="13,-16" name="no" to="end1"/>
  |       <transition g="-26,30" name="yes" to="join1"/>
  |    </task>
  |    <state g="82,314,92,52" name="approved">
  |       <transition g="-48,-21" name="to end1" to="end1">
  |       <timer duedate="3 minutes"/>
  |       </transition>
  |    </state>
  |    <join name="join1" g="102,225,48,48">
  |       <transition g="-73,-21" name="to approved" to="approved"/>
  |    </join>
  | </process>
  | 


  | import java.util.Iterator;
  | import java.util.List;
  | import java.util.Set;
  | 
  | import org.jbpm.api.ProcessInstance;
  | import org.jbpm.api.job.Job;
  | import org.jbpm.api.task.Task;
  | import org.jbpm.test.JbpmTestCase;
  | 
  | 
  | public class MeinTestfall extends JbpmTestCase {
  | 
  | String deploymentId;
  |   
  |   protected void setUp() throws Exception {
  |     super.setUp();
  |     
  |     deploymentId = repositoryService.createDeployment()
  |         .addResourceFromClasspath("parallel.jpdl.xml")
  |         .deploy();
  |   }
  | 
  |   protected void tearDown() throws Exception {
  |     repositoryService.deleteDeploymentCascade(deploymentId);
  |     
  |     super.tearDown();
  |   }
  |   
  |   public void testProcess() {
  |       
  |     ProcessInstance processInstance = 
executionService.startProcessInstanceById("parallel-2");
  |     
  |     List<Task> tasksMike = taskService.findPersonalTasks("mike");
  |     List<Task> tasksPeter = taskService.findPersonalTasks("peter");
  |     
  |     if(tasksMike.size() == 0) {
  |             fail();
  |     }
  | 
  |     if(tasksPeter.size() == 0) {
  |             fail();
  |     }   
  |      
  |     Set<String> activities = processInstance.findActiveActivityNames();
  |     
  |     Iterator<String> iterator = activities.iterator();
  |     
  |     while(iterator.hasNext()) {
  |             System.out.println(iterator.next());
  |     }
  |     
  |     taskService.completeTask(tasksMike.get(0).getId(), "yes");
  |     taskService.completeTask(tasksPeter.get(0).getId(), "yes");
  | 
  |     processInstance = 
executionService.findProcessInstanceById(processInstance.getId());
  |     
  |     activities = processInstance.findActiveActivityNames();
  |     iterator = activities.iterator();
  |     
  |     while(iterator.hasNext()) {
  |             System.out.println(iterator.next());
  |     }    
  |     
  |     assertTrue(processInstance.isActive("approved"));
  |     
  |     // executing the job which would normally be executed by the JobExecutor
  |     Job job = managementService.createJobQuery()
  |     .timers()
  |     .processInstanceId(processInstance.getId())
  |     .uniqueResult();
  |   
  |     managementService.executeJob(job.getId());
  |     
  |     // process instance should be finished right now
  |     
assertNull(executionService.findProcessInstanceById(processInstance.getId()));
  |  
  |   }
  |     
  | }
  | 
  | 

Hints??

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

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258805
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to