1 Reply Latest reply on Oct 30, 2012 12:57 PM by Maciej Swiderski

    Unable to complete tasks after calling ksession.dispose

    sreeramk82 Newbie

      Hi,

       

      I am unable to complete a task after disposing a knowledge sesion which created the owning process of the task.

      I am using jBPM 5.3.0 Final version.

      Please find below the stacktrace. 

       

      java.lang.IllegalStateException: Illegal method call. This session was previously disposed.

                 org.drools.reteoo.DisposedReteooWorkingMemory.getWorkItemManager(DisposedReteooWorkingMemory.java:386)

                 org.drools.impl.StatefulKnowledgeSessionImpl.getWorkItemManager(StatefulKnowledgeSessionImpl.java:311)

                org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:69)

                org.drools.command.runtime.process.CompleteWorkItemCommand.execute(CompleteWorkItemCommand.java:32)

                org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)

                org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:367)

                org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(CommandBasedStatefulKnowledgeSession.java:150)

                org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:221)

                org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:182)

                org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:307)

                org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:73)

               org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:46)

              org.jbpm.task.service.TaskServiceSession.postTaskCompleteOperation(TaskServiceSession.java:502)

              org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:468)

             org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:80)

              com.sample.ProcessCompleteTest.main(ProcessCompleteTest.java:86)]

      Let me know of nay possible solution for this .Thanks

        • 1. Re: Unable to complete tasks after calling ksession.dispose
          Maciej Swiderski Master

          you must have an active knowledge session to be able to complete task. If you loaded one from db please make sure you have work item handler for handling human task active as well (meaning connected to task server). If you disposed previous session it is good to dispose your work item handler for human tasks as it needs to be disconnected otherwise it will keep getting events from task server and could lead to the exception you have. Session is already disposed but handler was still active.

           

          HTH