cancel
Showing results for 
Search instead for 
Did you mean: 

Error forcing a timer event in a test case

brianshowers
Champ in-the-making
Champ in-the-making
I'm trying to write an automated test case to simulate the behavior of some timers that are in my process diagram.  However, whenever I call managementService.executeJob(), I get an "already taking a transition" exception.  Is there something else that I need to do?  I'm currently using Activiti 5.11.  The process instance that I'm starting starts a single timer which escalates if no action is taken for one hour.


@Test
@Deployment
public void myTimerTestExample() {

    //Start a new process instance
    String processDefinitionKey = "mykey";
    ProcessInstance instance = runtimeService.startProcessInstanceByKey(processDefinitionKey);
    String processInstanceId = instance.getProcessInstanceId();

    //Find the timer job.  For this process, there is exactly one timer job which is always started
    Job timerJob = managementService.createJobQuery().processInstanceId(processInstanceId).singleResult();
    Assert.assertNotNull(timerJob );

    //Force the timer to fire
    managementService.executeJob(timerJob .getId());

    //TODO: Validate the results of the timer executing
}

I get the following exception when calling managementService.executeJob():

2013-01-28 18:18:39 ERROR org.activiti.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler exception during timer execution
org.activiti.engine.impl.pvm.PvmException: already taking a transition
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:363) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:102) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:51) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute(ServiceTaskDelegateExpressionActivityBehavior.java:77) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:65) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:115) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:370) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:102) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:51) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:68) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:65) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:115) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:370) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:102) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:51) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior.execute(ServiceTaskExpressionActivityBehavior.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:65) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:115) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:85) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:535) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:530) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:370) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:102) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:51) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivitiBehaviour.signal(IntermediateCatchEventActivitiBehaviour.java:27) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:353) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.jobexecutor.TimerCatchIntermediateEventJobHandler.execute(TimerCatchIntermediateEventJobHandler.java:46) ~[activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:80) [activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.persistence.entity.TimerEntity.execute(TimerEntity.java:62) [activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:68) [activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) [activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:60) [activiti-engine-5.11.jar:5.11]
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) [activiti-spring-5.11-WSM-01.jar:na]
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) [spring-tx-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) [activiti-spring-5.11-WSM-01.jar:na]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32) [activiti-engine-5.11.jar:5.11]
   at org.activiti.engine.impl.ManagementServiceImpl.executeJob(ManagementServiceImpl.java:57) [activiti-engine-5.11.jar:5.11]
   at com.whaleshark.ActivitiTestError.myTimerTestExample(ActivitiTestError.java:48) [test-classes/:na]
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_25]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_25]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_25]
   at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_25]
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [junit-4.11.jar:na]
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na]
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [junit-4.11.jar:na]
   at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.11.jar:na]
   at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.11.jar:na]
   at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:53) [junit-4.11.jar:na]
   at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na]
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) [junit-4.11.jar:na]
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) [junit-4.11.jar:na]
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) [junit-4.11.jar:na]
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) [junit-4.11.jar:na]
   at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.junit.runners.ParentRunner.run(ParentRunner.java:309) [junit-4.11.jar:na]
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) [spring-test-3.2.0.RELEASE.jar:3.2.0.RELEASE]
   at org.junit.runner.JUnitCore.run(JUnitCore.java:160) [junit-4.11.jar:na]
   at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) [junit-rt.jar:na]
   at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) [junit-rt.jar:na]
   at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) [junit-rt.jar:na]
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
Did you configure your process engine with the job executor enabled? That might cause the exception you see.

brianshowers
Champ in-the-making
Champ in-the-making
I don't think that's the problem.  I added the following two lines to my test case to verify


boolean active = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getJobExecutor().isActive();
Assert.assertTrue(active);

With the new version of the test, I still get the same exception when calling executeJob()


@Test
@Deployment
public void myTimerTestExample() {
    //Unfortunately, the ProcessEngine interface doesn't expose the JobExecutor
    //So we are forced to cast to the implementation
    boolean active = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getJobExecutor().isActive();
    Assert.assertTrue(active);

    //Start a new process instance
    String processDefinitionKey = "mykey";
    ProcessInstance instance = runtimeService.startProcessInstanceByKey(processDefinitionKey);
    String processInstanceId = instance.getProcessInstanceId();

    //Find the timer job.  For this process, there is exactly one timer job which is always started
    Job timerJob = managementService.createJobQuery().processInstanceId(processInstanceId).singleResult();
    Assert.assertNotNull(timerJob );

    //Force the timer to fire
    managementService.executeJob(timerJob.getId());

    //TODO: Validate the results of the timer executing
}

brianshowers
Champ in-the-making
Champ in-the-making
I think I found the issue.  It's related to upgrading from Activiti 5.10 to 5.11.  The issue was that the timer I was firing sent a signal that tried to kill the process that owned it.  In v5.10, it appears that this was acceptable.  A sub-process could send a signal to cancel itself.  It appears that is no longer possible as of v5.11.  If a sub-process sends a signal that cancels itself, you'll get these exceptions.

Is that expected behavior or a bug in the latest release?

frederikherema1
Star Contributor
Star Contributor
Using a timer-event to trigger a signal to cancel the sub-process that OWNS the timer is not something that you want to do. The fact that it worked on 5.10 is probably an implementation detail.

Why don't you let the timer-boundary event be placed on the subprocess-boundary and have interrupt the subprocess ("cancelActivity=true")?