Zahid Ahmed [
https://community.jboss.org/people/ahmedza] created the discussion
"Muliplt Ksessions | event is not getting dispatched to the
StatefulKnowledgeSession"
To view the discussion, visit:
https://community.jboss.org/message/808115#808115
--------------------------------------------------------------
*+strong text+*What could be the problem if the task-completed event is not getting
dispatched to the StatefulKnowledgeSession ?
For a new process-instance, I do
* create a new session register human-task local GenericHTWorkItemHandler
register custom event listeners
call startProcess(processDefinitionId,parameters);
It starts a new instance, creates the first human-task via the registered
human-task-handler.
When I want to complete the human-task, I do
* restore the KnowledgeSession with
JPAKnowledgeService.loadStatefulKnowledgeSession(lastSessionId,kBase,null, env); again
register human-task local GenericHTWorkItemHandler
again register custom event listeners
Then call taskService.completeTask, BUT the task-completed is not dispatched to the
KnowledgeSession. And the process-flow is not happening
Should I not register the event listeners again ? Should I not register the
work-item-handlers again ?
*Update 1* Exception trace:
07:52:09,618 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/workflow-console].[rsservlet]]
(http--0.0.0.0-8280-15) Servlet.service() for servlet rsservlet threw exception:
java.lang.IllegalStateException: EntityManager is closed
at
org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1158)
[hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at
org.drools.container.spring.beans.persistence.DroolsSpringJpaManager.getApplicationScopedPersistenceContext(DroolsSpringJpaManager.java:89)
[drools-spring-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:350)
[drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
at
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.getEnvironment(CommandBasedStatefulKnowledgeSession.java:478)
[drools-core-5.5.0.Final.jar:5.5.0.Final]
at
org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.handleCompletedTask(GenericHTWorkItemHandler.java:260)
[jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at
org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler$TaskCompletedHandler.execute(GenericHTWorkItemHandler.java:234)
[jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
at
org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:329)
[jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
When reloading a session I am registering new HumanTaskWorkItemhandlers.It keeps on
registering event handlers with the TaskService.
When I connect the workItemHandlers, they register eventHandlers with the taskService.
When will this eventHandlers get de-registered from the taskService ?
Environment:JBPM 5.4.0.Final, Drools 5.5.0.Final, Jboss 7.1.0.Final
I debugged through the code, task-completed-event was dispatched to more than 1 session.It
must be a problem with my ksession management.I created the GenericHTWorkItemHandler with
owningKSessionOnly=true but this didn't worked.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/808115#808115]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]