4 Replies Latest reply on Mar 22, 2011 4:04 AM by Samrat Roy

    JBPM exception : no process definition with key

    Samrat Roy Newbie

      Hi I am new to jBpm  , though I have run a couple of examples and i am comfortable with the idea.

       

      I am trying to build a spring web application with jBpm 4.4 and I have defined my process defintion jpdl files. The problem is :

       

      I have made a Spring bean in the application Context as :

       

      <bean id="jbpmRepositoryUtil" class="com.canon.common.util.JbpmRepositoryUtil">

          <constructor-arg>

              <value>jpdl/LeaveApply.jpdl.xml</value>

          </constructor-arg>

          <constructor-arg>

              <value>jpdl/LeaveDB_bal_Status.jpdl.xml</value>

          </constructor-arg>

          <constructor-arg>

               <value>jpdl/ApproverFlow.jpdl.xml</value>

          </constructor-arg>

          <constructor-arg>

               <ref bean ="repositoryService"/>

          </constructor-arg>

      </bean>

       

       

      This bean deploys three Jpdl files at the server Startup (jboss 4.2) . Like:

      public JbpmRepositoryUtil (String mainJpdlPath,String subProcessPath,String approverPath ,RepositoryService repositoryService){

              mainFlowId = repositoryService.createDeployment().addResourceFromClasspath(mainJpdlPath).deploy();

              dbSubProcessId = repositoryService.createDeployment().addResourceFromClasspath(approverPath).deploy();

              approverFlowId = repositoryService.createDeployment().addResourceFromClasspath(subProcessPath).deploy();

          }

       

       

       

      I have run the server in debug mode an confirmed that the method is being hit.

       

      But when I try to start a process instance in my service class like :

       

      ProcessInstance processInstance = executionService.startProcessInstanceByKey("LeaveApply",variables);

       

      I get the following error :

       

      org.jbpm.api.JbpmException: no process definition with key 'LeaveApply'

          at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:58)

          at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:36)

          at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)

          at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)

      .....

       

       

      Naming isnt an issue because if i copy the createDeployment method to the service class just before trying to create a PI it works just fine ..  but according to my understanding I should be deploying the jpdl just once and create ProcessInstance as and when needed. So copying to the service class is a bad idea !

       

      Adding to the previous :

      I am using the same sessionFactory for both jbpm and my application .

       

      Please find attached my jBpm-Context.xml and jbpm-cfg.xml

       

      HELP !