9 Replies Latest reply on Oct 9, 2009 7:30 PM by Sebastian Schneider

    Unit test succeeds but process does not properly run when de

    Sebastian Schneider Master

      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"/>
       <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"/>
       <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 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"/>
       <state g="82,314,92,52" name="approved">
       <transition g="-48,-21" name="to end1" to="end1">
       <timer duedate="3 minutes"/>
       <join name="join1" g="102,225,48,48">
       <transition g="-73,-21" name="to approved" to="approved"/>

      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 {
       deploymentId = repositoryService.createDeployment()
       protected void tearDown() throws Exception {
       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) {
       if(tasksPeter.size() == 0) {
       Set<String> activities = processInstance.findActiveActivityNames();
       Iterator<String> iterator = activities.iterator();
       while(iterator.hasNext()) {
       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()) {
       // executing the job which would normally be executed by the JobExecutor
       Job job = managementService.createJobQuery()
       // process instance should be finished right now


        • 1. Re: Unit test succeeds but process does not properly run whe
          Ronald van Kuijk Master

          If the unit tests run, it means the processdefinition is ok, your usage of the api is ok, your expectation of what the engine does is ok, the way the testbaseclasses use the engine etc are ok, but it does not mean and I do not want to do any fingerpointing whatsoever, that the console uses the api in the same correct way. Maybe there have been some changes in the api that were not incorporated in the console yet.

          Do you have the full stacktrace to show where the error occurs? If you think it is caused by the console, please post in that forum (not under jBPM, but under http://www.jboss.org/community/wiki/BPMConsole)

          • 2. Re: Unit test succeeds but process does not properly run whe
            Sebastian Schneider Master

            I will try to verify on a second installation and I will post the stacktrace tomorrow.

            • 3. Re: Unit test succeeds but process does not properly run whe
              Sebastian Schneider Master

              From the Tomcat log files:

              07.10.2009 07:55:32 org.hibernate.LazyInitializationException <init>
              SCHWERWIEGEND: could not initialize proxy - no Session
              org.hibernate.LazyInitializationException: could not initialize proxy - no Session
               at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:86)
               at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
               at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
               at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_4.getId(ExecutionImpl_$$_javassist_4.java)
               at org.jbpm.integration.console.ModelAdaptor.adoptTask(ModelAdaptor.java:147)
               at org.jbpm.integration.console.TaskManagementImpl.adoptTasks(TaskManagementImpl.java:69)
               at org.jbpm.integration.console.TaskManagementImpl.getAssignedTasks(TaskManagementImpl.java:49)
               at org.jboss.bpm.console.server.TaskListFacade.getTasksForIdRef(TaskListFacade.java:99)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
               at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
               at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
               at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
               at org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
               at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
               at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
               at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
               at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
               at java.lang.Thread.run(Thread.java:619)

              • 4. Re: Unit test succeeds but process does not properly run whe
                Sebastian Schneider Master

                I am going to raise the log level and repost the log.

                • 5. Re: Unit test succeeds but process does not properly run whe
                  Ronald van Kuijk Master

                  Sigh..... again a post where my reply is not visible... What is going on here?

                  What I replied was: If the unit test works does not mean it works from the console as well. The api used by the console might e.g. not be fully updated yet or something like that. You could try posting in the BPM Console forum as well or refer to this topic from there.

                  • 6. Re: Unit test succeeds but process does not properly run whe
                    Sebastian Schneider Master

                    Thanks for the hint. Right now I was trying it again and it shows up like that I also get into trouble if I use the API directly. I have a webservice invoking methods on the jBPM API. By the use of the API I can start a new process instance and I can grab the assigned process instance id. I can even query for the active activities and they show up right. But as soon as I want to access the task list of one of the users having the tasks in their list an exception is thrown:

                    Caused by: org.hibernate.LazyInitializationException: could not initialize proxy
                     - no Session
                     at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyIn
                     at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(Abstrac
                     at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(Ja
                     at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_4.getId(Execut

                    When retrieving the task list of a user who does not participate in the process no exception is thrown.

                    To me this now looks a bit like the different resolved or rejected issues related to problems with fork and join. Since I got the problems although without using the console it can't be because or just because of the console.

                    Confused regards

                    • 7. Re: Unit test succeeds but process does not properly run whe
                      Sebastian Schneider Master

                      It must be something due to the fork-join. I added an additional task assigned to one of the users before the fork and could complete it. After reaching the fork the problems started and I couldn't get the users's tasklist anymore. But even with the changed process definition I can't start a new process instance in the console. I see the process definition in the list and I can push the start button to create a new instance. But nothing happens afterwards. There is neither an error message or exception nor a new process instance in the refreshed list.

                      • 9. Re: Unit test succeeds but process does not properly run whe
                        Sebastian Schneider Master

                        Process definition and unit test are in the first post but I just encounter the problem as soon as the process is deployed on the server.