0 Replies Latest reply on Sep 22, 2006 4:15 AM by d b

    problem: the TaskMgmtInstance cannot return ProcessInstance

    d b Newbie

      I have a very strange problem, when iterating over tasks for an actor, i cannot access the ProcessInstance.

      I have not had any problems before with this, and suddenly recieved this problem two days ago (my database consists of 720 tasks and 280 process instances).

      It started the day before yesterday when the ProcessInstance returned was null for two tasks (for all other tasks in the iteration it was fine),
      yesterday suddenly all tasks returns null when calling getProcessInstance();

      I assume that my database has somehow gone corrupt....has anyone experienced something similar, or can think of a good way how to tackle this problem? (Can i get the processInstance in some other way perhaps?)

      here is the code (for clarity I removed all irrelevant parts)

      JbpmContext jbpmContext = null;
      
      try {
       jbpmContext = jbpmConfiguration.createJbpmContext();
      } catch (Exception e) {
       throw new WorkflowEngineException(errMsg);
      }
      
      try {
       TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
       myTasks = taskMgmtSession.findTaskInstances(uid);
      } catch (Exception e) {
       throw new WorkflowEngineException(errMsg);
      }
      
      
      try {
       for (Iterator iter = myTasks.iterator(); iter.hasNext();) {
       TaskInstance myTaskInstance = (TaskInstance) iter.next();
      
       TaskMgmtInstance tskMgt = myTaskInstance.getTaskMgmtInstance();
      
       ProcessInstance procInstance = tskMgt.getProcessInstance();
       
       //here it breaks, since procInstance will be null!
       long processId = procInstance.getId();
       }
      } finally {
       jbpmContext.close();
      }