0 Replies Latest reply on Sep 10, 2009 2:43 AM by Jay Kumbhani

    Jbpm 4.0 error prone code...

    Jay Kumbhani Newbie

      We are using Client API for building process definition from XML file and starting execution by using the process def:

      Attach is code where we are getting some hibernate error.


      protected void processJob(){
      WorkflowProcessInstance wpi = (WorkflowProcessInstance) this.getJobDataObject();
      ExecutionImpl pi = wpi.getJbpmProcessInstace();
      if((pi.getState().equals(ProcessInstance.STATE_CREATED))) {
      pi.start();
      }
      while (!pi.isEnded()) {
      if (!terminateJob) {
      ServerUtils.log(ServerUtils.DEBUG," Moving to next stage.");
      String execName = null;
      Iterator itr = pi.findActiveActivityNames().iterator();
      while(itr.hasNext()) {
      execName = (String)itr.next();
      ExecutionImpl execution = pi.findActiveExecutionIn(execName);
      if(execution.getState().equals(Execution.STATE_INACTIVE_CONCURRENT_ROOT) ||
      execution.getState().equals(Execution.STATE_INACTIVE_JOIN) ||
      execution.getState().equals(Execution.STATE_INACTIVE_SCOPE)) {
      execution = execution.getExecutions().iterator().next();
      }
      if (execution.isActive() && !execution.isEnded()) {
      execution.signal(); pi = execution.getProcessInstance();
      }
      }
      } else {
      pi.end();
      }
      }
      }


      The highlighted line gives error when it signals on end state (Means when the workflow ends). It state hibernate error as listed below.



      org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl#0]
      at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:409)
      at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:108)
      at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:97)
      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.history.model.HistoryProcessInstanceImpl_$$_javassist_2.setEndTime(HistoryProcessInstanceImpl_$$_javassist_2.java)
      at org.jbpm.pvm.internal.history.events.ProcessInstanceEnd.process(ProcessInstanceEnd.java:41)
      at org.jbpm.pvm.internal.history.HistorySessionImpl.process(HistorySessionImpl.java:31)
      at org.jbpm.pvm.internal.history.HistoryEvent.fire(HistoryEvent.java:61)
      at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:353)
      at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:311)
      at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:80)
      at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:45)
      at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
      at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
      at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:398)
      at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:380)
      at com.santafe.soa.server.engine.workflow.WorkflowJob.processJob(WorkflowJob.java:95)
      at com.santafe.soa.server.engine.workflow.WorkflowJob.run(WorkflowJob.java:123)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
      at java.lang.Thread.run(Thread.java:619)