2 Replies Latest reply on Jan 29, 2010 4:20 PM by ben d

    Exception in ExecutionImpl.getActivity

    ben d Newbie

      Hi there,

       

      I'm new to JBPM and there is something I must do wrong.

       

      My process definition file is the following:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <process name="TaskAssignmentHandler" xmlns="http://jbpm.org/4.3/jpdl">
        <start g="20,20,48,48">
          <transition to="review" />
        </start>
        <task name="review" g="96,16,127,52" form="/path_to_your_form/form.html" >
          <transition to="wait" />
        </task>
        <state name="wait" g="255,16,88,52" />
      </process>
      

       

       

      My test case:

       

      public class TestEngine {
      
           public static void main(String[] args) {
                ProcessEngine processEngine = new Configuration().buildProcessEngine();
                ExecutionService executionService = processEngine.getExecutionService();
      
                RepositoryService repoService = processEngine.getRepositoryService();
      
                NewDeployment deployment = repoService.createDeployment().addResourceFromClasspath(
                          "workflows/task-process.jpdl.xml");
                deployment.deploy();
                ProcessInstance pi = executionService.startProcessInstanceByKey("TaskAssignmentHandler");
                pi = executionService.findProcessInstanceById(pi.getId());
                ((ExecutionImpl) pi).getProcessDefinition();
      
           }
      
      }
      
      

      I know I don't need to call the findProcessInstanceById since I already have a process instance, but this is to do exactly the same as in my application (ie get process instance from the database).

       

      The deployment and the start process work just fine. But I get the following exception on the getProcessDefinition call:

       

      Exception in thread "main" org.jbpm.api.JbpmException: no environment to get org.jbpm.pvm.internal.session.RepositorySession
           at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:197)
           at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:190)
           at org.jbpm.pvm.internal.model.ExecutionImpl.getProcessDefinition(ExecutionImpl.java:1121)
           at TestEngine.main(TestEngine.java:36)
      

       

      And my configuration file  (jbpm.cfg.xml):

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <jbpm-configuration>
      
        <import resource="jbpm.default.cfg.xml" />
        <import resource="jbpm.tx.hibernate.cfg.xml" />
        <import resource="jbpm.jpdl.cfg.xml" />
      <!--  <import resource="jbpm.bpmn.cfg.xml" />-->
        <import resource="jbpm.identity.cfg.xml" />
        <import resource="jbpm.businesscalendar.cfg.xml" />
      
      </jbpm-configuration>
      
      I'm using JBPM 4.3.

      Is there anything I do wrong?

       

      Thanks in advance,

      Benjamin