[jBPM] - Problem in a process with a event-based timer and JPAWorkingMemoryDbLogger
by Marco Piraccini
Marco Piraccini [http://community.jboss.org/people/mpiraccini] created the discussion
"Problem in a process with a event-based timer and JPAWorkingMemoryDbLogger"
To view the discussion, visit: http://community.jboss.org/message/621274#621274
--------------------------------------------------------------
Hi Guys,
I have a very simple process with a timer event:
http://community.jboss.org/servlet/JiveServlet/showImage/2-621274-16871/p... http://community.jboss.org/servlet/JiveServlet/downloadImage/2-621274-168...
The timer has a timeCylce of 500ms. The scripts simply set a variable (message1 and message2) that i look to see of the scripts has been executed.
My test see that -after the prcess start- the first task is executed, waits for 1000ms and then check the that the second task has been executed (inspecting the message2 variable). Also the test check that the process is completed.
The Task2 script task containt that code:
<bpmn2:script>
System.out.println("Executing Script Task 1");
kcontext.setVariable("message","Executed Script Task 1");
</bpmn2:script>
That works perfectly...at least until I add:
JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(session);
When I do that, it seems that:
- The timer does not trigger the "Script Task 2" task.
- The error below appears in the console:
Hibernate: insert into NodeInstanceLog (id, log_date, nodeId, nodeInstanceId, nodeName, processId, processInstanceId, type) values (null, ?, ?, ?, ?, ?, ?, ?)
INFO BitronixTransactionManager - shutting down Bitronix Transaction Manager
org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@22862041
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:845)
at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:89)
at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:164)
at org.drools.time.impl.JDKTimerService$JDKCallableJob.call(JDKTimerService.java:151)
at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.internalCall(JpaJDKTimerService.java:80)
at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.access$100(JpaJDKTimerService.java:63)
at org.drools.persistence.jpa.JpaJDKTimerService$JDKCallableJobCommand.execute(JpaJDKTimerService.java:96)
at org.drools.persistence.jpa.JpaJDKTimerService$JDKCallableJobCommand.execute(JpaJDKTimerService.java:84)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:292)
at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:75)
at org.drools.persistence.jpa.JpaJDKTimerService$JpaJDKCallableJob.call(JpaJDKTimerService.java:63)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at org.jbpm.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:67)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.getWorkflowProcess(WorkflowProcessInstanceImpl.java:180)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.getNodeContainer(WorkflowProcessInstanceImpl.java:68)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.getNode(NodeInstanceImpl.java:100)
at org.jbpm.workflow.instance.node.ActionNodeInstance.getActionNode(ActionNodeInstance.java:35)
at org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:43)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:122)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerConnection(NodeInstanceImpl.java:185)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:150)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:162)
at org.jbpm.workflow.instance.node.TimerNodeInstance.triggerCompleted(TimerNodeInstance.java:135)
at org.jbpm.workflow.instance.node.TimerNodeInstance.signalEvent(TimerNodeInstance.java:125)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:333)
at org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSignalManager.java:117)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
... 18 more
...any idea? It seems a bug to me...
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/621274#621274]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years
[jBPM] - fireUntilHalt with customworkhandler
by Hina Agarwal
Hina Agarwal [http://community.jboss.org/people/hina] created the discussion
"fireUntilHalt with customworkhandler"
To view the discussion, visit: http://community.jboss.org/message/626196#626196
--------------------------------------------------------------
If we use cutom workitem handler as mentioned below and fireUntilhalt to invoke rules in reactive mode. While debugging, I found that before completing first task(line in blue & bold), it fires the rule which is active. After running of rule, it get back to end of completeworkitem.It creates a problem an thrpw an exception mentioned below.
WorkItemHandler
public class MyHumanChangingValuesSimulatorWorkItemHandler implements WorkItemHandler {
private static int counter = 1;
private WorkItemManager workItemManager;
private long workItemId;
private Map<String, Object> results;
private Emergency currentEmergency;
public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) {
this.workItemId = workItem.getId();
this.workItemManager = workItemManager;
currentEmergency = (Emergency) workItem.getParameter("emergency");
currentEmergency.setRevision(currentEmergency.getRevision() + counter);
}
public void abortWorkItem(WorkItem workItem, WorkItemManager workItemManager) {
}
public void completeWorkItem() {
results = new HashMap<String, Object>();
results.put("emergency", currentEmergency);
workItemManager.completeWorkItem(workItemId, results);
}
}
Exception:
0 13/09 15:13:39,598[Thread-6] ERROR hibernate.util.JDBCExceptionReporter.logExceptions - error requeueing a JdbcPooledConnection from datasource jdbc/testDS in state ACCESSIBLE wrapping xads1: url=jdbc:h2:mem:mydb user=root
Hibernate: update ProcessInstanceInfo set lastModificationDate=?, lastReadDate=?, processId=?, processInstanceByteArray=?, startDate=?, state=?, OPTLOCK=? where InstanceId=? and OPTLOCK=?
3 13/09 15:13:39,601[Thread-6] ERROR hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException - Unable to mark for rollback on PersistenceException:
java.lang.IllegalStateException: no transaction started on this thread
at bitronix.tm.BitronixTransactionManager.setRollbackOnly(BitronixTransactionManager.java:123)
at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:421)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:576)
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:202)
at org.jbpm.persistence.JpaProcessPersistenceContext.findProcessInstanceInfo(JpaProcessPersistenceContext.java:26)
at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:59)
at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:190)
at org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1113)
at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:283)
at org.jbpm.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:24)
at org.jbpm.process.instance.ProcessRuntimeImpl$3.afterRuleFlowGroupDeactivated(ProcessRuntimeImpl.java:335)
at org.drools.event.AgendaEventSupport.fireAfterRuleFlowGroupDeactivated(AgendaEventSupport.java:168)
at org.drools.common.RuleFlowGroupImpl.setActive(RuleFlowGroupImpl.java:148)
at org.drools.common.RuleFlowGroupImpl$DeactivateCallback.execute(RuleFlowGroupImpl.java:301)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1037)
at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:777)
at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
at org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-6" org.drools.RuntimeDroolsException: Unexpected exception executing action org.drools.common.RuleFlowGroupImpl$DeactivateCallback@556949
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1037)
at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:777)
at org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:753)
at org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot release connection
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:202)
at org.jbpm.persistence.JpaProcessPersistenceContext.findProcessInstanceInfo(JpaProcessPersistenceContext.java:26)
at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:59)
at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:190)
at org.drools.common.AbstractWorkingMemory.getProcessInstance(AbstractWorkingMemory.java:1113)
at org.drools.impl.StatefulKnowledgeSessionImpl.getProcessInstance(StatefulKnowledgeSessionImpl.java:283)
at org.jbpm.persistence.processinstance.JPASignalManager.signalEvent(JPASignalManager.java:24)
at org.jbpm.process.instance.ProcessRuntimeImpl$3.afterRuleFlowGroupDeactivated(ProcessRuntimeImpl.java:335)
at org.drools.event.AgendaEventSupport.fireAfterRuleFlowGroupDeactivated(AgendaEventSupport.java:168)
at org.drools.common.RuleFlowGroupImpl.setActive(RuleFlowGroupImpl.java:148)
at org.drools.common.RuleFlowGroupImpl$DeactivateCallback.execute(RuleFlowGroupImpl.java:301)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
... 5 more
Hibernate: select processins0_.InstanceId as InstanceId1_0_, processins0_.lastModificationDate as lastModi2_1_0_, processins0_.lastReadDate as lastRead3_1_0_, processins0_.processId as processId1_0_, processins0_.processInstanceByteArray as processI5_1_0_, processins0_.startDate as startDate1_0_, processins0_.state as state1_0_, processins0_.OPTLOCK as OPTLOCK1_0_ from ProcessInstanceInfo processins0_ where processins0_.InstanceId=?
Caused by: org.hibernate.exception.GenericJDBCException: Cannot release connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:478)
at org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:429)
at org.hibernate.jdbc.ConnectionManager.afterStatement(ConnectionManager.java:304)
at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:572)
at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:291)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:307)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:234)
at org.hibernate.loader.Loader.doQuery(Loader.java:749)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1881)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3072)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)
... 16 more
Caused by: java.sql.SQLException: error requeueing a JdbcPooledConnection from datasource jdbc/testDS in state ACCESSIBLE wrapping xads1: url=jdbc:h2:mem:mydb user=root
at bitronix.tm.resource.jdbc.JdbcPooledConnection.release(JdbcPooledConnection.java:148)
at bitronix.tm.resource.jdbc.JdbcConnectionHandle.close(JdbcConnectionHandle.java:77)
at org.hibernate.connection.DatasourceConnectionProvider.closeConnection(DatasourceConnectionProvider.java:97)
at org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:474)
... 37 more
Caused by: bitronix.tm.internal.BitronixSystemException: cannot close a resource when its XAResource is taking part in an unfinished global transaction
at bitronix.tm.resource.common.TransactionContextHelper.requeue(TransactionContextHelper.java:117)
at bitronix.tm.resource.jdbc.JdbcPooledConnection.release(JdbcPooledConnection.java:146)
... 40 more
Please suggest me can we use fireUntilHalt() with customhumantask handler. Why it always beahave differently?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/626196#626196]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years
[jBPM] - Problem with Human Task Completion
by sandeep kumar
sandeep kumar [http://community.jboss.org/people/sandeep_jbpm5] created the discussion
"Problem with Human Task Completion"
To view the discussion, visit: http://community.jboss.org/message/627791#627791
--------------------------------------------------------------
Hi All,
I am facing one problem when completing a Human task. The problem arises when I use Spring drools integration. I am getting the ksession from spring bean. using that I am starting the process Instance. The process contains one human task. I am using SyncWSHumanTaskHandler and LocalTaskService. On call of task completion it throws exception as below
java.lang.IllegalStateException: EntityManager is closed
at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:66)
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
at $Proxy30.find(Unknown Source)
at org.drools.persistence.jpa.JpaPersistenceContext.findWorkItemInfo(JpaPersistenceContext.java:41)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:108)
at org.jbpm.process.workitem.wsht.SyncWSHumanTaskHandler$TaskCompletedHandler.execute(SyncWSHumanTaskHandler.java:278)
at org.jbpm.task.service.local.LocalTaskService$SimpleEventTransport.trigger(LocalTaskService.java:242)
at org.jbpm.task.event.MessagingTaskEventListener.taskCompleted(MessagingTaskEventListener.java:73)
at org.jbpm.task.event.TaskEventSupport.fireTaskCompleted(TaskEventSupport.java:47)
at org.jbpm.task.service.TaskServiceSession.taskCompleteOperation(TaskServiceSession.java:420)
at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:368)
at org.jbpm.task.service.local.LocalTaskService.complete(LocalTaskService.java:73)
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/627791#627791]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years