Tks for your reply Maciej.
Before do what you told, I tried another approach.
I dropped down the boundary events and try to implement this way:
https://community.jboss.org/servlet/JiveServlet/downloadImage/2-827948-21137/450-194/testeV2.png
I have another process to call this has reusable subprocess.
If the timer event 'Prazo' expires, then the Human Task is canceled and everything runs as expected.
But if I signal the event 'Cancelar' before timer event 'Prazo' expires, I get the same error:
1 15/07 11:13:57,756[main] ERROR drools.persistence.SingleSessionCommandService.rollbackTransaction - Could not commit session
org.jbpm.workflow.instance.WorkflowRuntimeException: [TesteV2Sub:645 - :2] -- null
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
at org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.EventNodeInstance.triggerCompleted(EventNodeInstance.java:66)
at org.jbpm.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:50)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:362)
at org.drools.command.runtime.process.SignalEventCommand.execute(SignalEventCommand.java:95)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.signalEvent(CommandBasedStatefulKnowledgeSession.java:210)
at com.sample.ProcessTestes.sinalizarEvento(ProcessTestes.java:130)
at com.sample.ProcessTestes.main(ProcessTestes.java:79)
Caused by: java.lang.NullPointerException
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector.write(HornetQTaskClientConnector.java:194)
at org.jbpm.task.service.TaskClient.getTaskByWorkItemId(TaskClient.java:473)
at org.jbpm.task.service.SyncTaskServiceWrapper.getTaskByWorkItemId(SyncTaskServiceWrapper.java:364)
at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler.abortWorkItem(GenericHTWorkItemHandler.java:203)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalAbortWorkItem(JPAWorkItemManager.java:78)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.cancel(WorkItemNodeInstance.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:269)
at org.jbpm.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:67)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
... 17 more
Exception in thread "main" org.jbpm.workflow.instance.WorkflowRuntimeException: [TesteV2Sub:645 - :2] -- null
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
at org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.EventNodeInstance.triggerCompleted(EventNodeInstance.java:66)
at org.jbpm.workflow.instance.node.EventNodeInstance.signalEvent(EventNodeInstance.java:50)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:362)
at org.drools.command.runtime.process.SignalEventCommand.execute(SignalEventCommand.java:95)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession.signalEvent(CommandBasedStatefulKnowledgeSession.java:210)
at com.sample.ProcessTestes.sinalizarEvento(ProcessTestes.java:130)
at com.sample.ProcessTestes.main(ProcessTestes.java:79)
Caused by: java.lang.NullPointerException
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector.write(HornetQTaskClientConnector.java:194)
at org.jbpm.task.service.TaskClient.getTaskByWorkItemId(TaskClient.java:473)
at org.jbpm.task.service.SyncTaskServiceWrapper.getTaskByWorkItemId(SyncTaskServiceWrapper.java:364)
at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler.abortWorkItem(GenericHTWorkItemHandler.java:203)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalAbortWorkItem(JPAWorkItemManager.java:78)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.cancel(WorkItemNodeInstance.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:269)
at org.jbpm.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:67)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
... 17 more
250526 15/07 11:18:08,281[pool-1-thread-1] ERROR instance.timer.TimerManager.execute - Error when executing timer job
org.drools.RuntimeDroolsException: Unexpected exception executing action org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction@464e32c8
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:995)
at org.drools.impl.StatefulKnowledgeSessionImpl.executeQueuedActions(StatefulKnowledgeSessionImpl.java:866)
at org.jbpm.process.instance.event.DefaultSignalManager.signalEvent(DefaultSignalManager.java:90)
at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:323)
at org.drools.time.SelfRemovalJob.execute(SelfRemovalJob.java:15)
at org.drools.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:51)
at org.drools.persistence.jpa.JpaTimerJobInstance.internalCall(JpaTimerJobInstance.java:43)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:20)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:6)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:34)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:14)
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: org.jbpm.workflow.instance.WorkflowRuntimeException: [TesteV2Sub:645 - :2] -- null
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:132)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at org.jbpm.workflow.instance.node.JoinInstance.triggerCompleted(JoinInstance.java:152)
at org.jbpm.workflow.instance.node.JoinInstance.internalTrigger(JoinInstance.java:52)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:279)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:238)
at org.jbpm.workflow.instance.impl.ExtendedNodeInstanceImpl.triggerCompleted(ExtendedNodeInstanceImpl.java:47)
at org.jbpm.workflow.instance.node.StateBasedNodeInstance.triggerCompleted(StateBasedNodeInstance.java:216)
at org.jbpm.workflow.instance.node.TimerNodeInstance.triggerCompleted(TimerNodeInstance.java:157)
at org.jbpm.workflow.instance.node.TimerNodeInstance.signalEvent(TimerNodeInstance.java:147)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:342)
at org.jbpm.process.instance.event.DefaultSignalManager$SignalProcessInstanceAction.execute(DefaultSignalManager.java:118)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:993)
... 19 more
Caused by: java.lang.NullPointerException
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector.write(HornetQTaskClientConnector.java:194)
at org.jbpm.task.service.TaskClient.getTaskByWorkItemId(TaskClient.java:473)
at org.jbpm.task.service.SyncTaskServiceWrapper.getTaskByWorkItemId(SyncTaskServiceWrapper.java:364)
at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler.abortWorkItem(GenericHTWorkItemHandler.java:203)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalAbortWorkItem(JPAWorkItemManager.java:78)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.cancel(WorkItemNodeInstance.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:269)
at org.jbpm.workflow.instance.node.EndNodeInstance.internalTrigger(EndNodeInstance.java:67)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:126)
... 33 more
java.lang.NullPointerException
at org.jbpm.task.service.hornetq.HornetQTaskClientConnector.write(HornetQTaskClientConnector.java:194)
at org.jbpm.task.service.TaskClient.getTaskByWorkItemId(TaskClient.java:473)
at org.jbpm.task.service.SyncTaskServiceWrapper.getTaskByWorkItemId(SyncTaskServiceWrapper.java:364)
at org.jbpm.process.workitem.wsht.GenericHTWorkItemHandler.abortWorkItem(GenericHTWorkItemHandler.java:203)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalAbortWorkItem(JPAWorkItemManager.java:78)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.cancel(WorkItemNodeInstance.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:257)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.setState(WorkflowProcessInstanceImpl.java:269)
at org.jbpm.process.instance.timer.TimerManager$ProcessJob.execute(TimerManager.java:337)
at org.drools.time.SelfRemovalJob.execute(SelfRemovalJob.java:15)
at org.drools.time.impl.DefaultTimerJobInstance.call(DefaultTimerJobInstance.java:51)
at org.drools.persistence.jpa.JpaTimerJobInstance.internalCall(JpaTimerJobInstance.java:43)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:20)
at org.drools.persistence.jpa.JDKCallableJobCommand.execute(JDKCallableJobCommand.java:6)
at org.drools.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36)
at org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:373)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:34)
at org.drools.persistence.jpa.JpaTimerJobInstance.call(JpaTimerJobInstance.java:14)
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)