JBoss Community

Re: Problem in JPAWorkItemManager when completing a task

created by Juan Gago in jBPM - View the full discussion

Thanks for the response

 

 

I am using JPAKnowledgeService, initialized from Spring application context configuration file:

          <jbpm:kbase id="kbase">

                    <jbpm:resources>

                              <jbpm:resource type="BPMN2" source="classpath:workflows/Test.bpmn" />

                    </jbpm:resources>

          </jbpm:kbase>

          <jbpm:ksession id="ksession" type="stateful" kbase="kbase">

                    <jbpm:configuration>

                              <jbpm:jpa-persistence>

                                        <jbpm:entity-manager-factory ref="entityManagerFactory"/>

                                        <jbpm:transaction-manager ref="transactionManager"/>

                              </jbpm:jpa-persistence>

                    </jbpm:configuration>

          </jbpm:ksession>

 

 

CommandBasedWSHumanTaskHandler is configured to execute connect method at application startup.

And for completing a task the code just execute the task client method:

          BlockingTaskOperationResponseHandler completeResponseHandler = new BlockingTaskOperationResponseHandler();

          getTaskClient().complete(taskId, userId, null, completeResponseHandler);

          completeResponseHandler.waitTillDone(getClientMaxWaitTime());

 

 

The session is loaded, because I previously can create process instances, and the task client can change task status to Completed.

 

 

Should I do something more? What listener must I declare?

The CommandBasedWSHumanTaskHandler.connect works fine, but when TaskCompletedHandler executes the PersistenceContext stored in the session environment has a reference to a closed EntityManager.

Reply to this message by going to Community

Start a new discussion in jBPM at Community