maxlich

Errors in service tasks after timers when my app is running and activiti-app is running

Discussion created by maxlich on Dec 11, 2018

Hello.

I have such a scheme:
my test scheme

And the XML represantation:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
<process id="MaxShulTest_rlic_2_v5" name="MaxShulTest_rlic" isExecutable="true">
<documentation>test process rlic</documentation>
<startEvent id="startEvent1"></startEvent>
<userTask id="Task1" name="Task1"></userTask>
<userTask id="Task4" name="Task4"></userTask>
<userTask id="Task2" name="Task2"></userTask>
<sequenceFlow id="sid-A71A6EB8-293E-4EA7-A876-670C8E4ABF7C" sourceRef="Task2" targetRef="ExclusiveGateway1"></sequenceFlow>
<sequenceFlow id="sid-1691D37B-9B00-452F-B031-124B3845912B" sourceRef="Task4" targetRef="ExclusiveGateway1"></sequenceFlow>
<endEvent id="endEvent1"></endEvent>
<sequenceFlow id="sid-EAC37DEB-9666-407E-8EE0-27C11CEC4302" sourceRef="ExclusiveGateway1" targetRef="endEvent1"></sequenceFlow>
<exclusiveGateway id="ExclusiveGateway1"></exclusiveGateway>
<boundaryEvent id="boundary_timer1" attachedToRef="Task1" cancelActivity="true">
<timerEventDefinition>
<timeDuration>${timer}</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<serviceTask id="service_task_1" name="service_task_1" activiti:expression="${activitiLogDelegateService.log(&quot;Service task 1&quot;)}"></serviceTask>
<intermediateCatchEvent id="timer_1" name="timer_1">
<timerEventDefinition>
<timeDuration>${timer}</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<serviceTask id="service_task_2" name="service_task_2" activiti:expression="${activitiLogDelegateService.log(&quot;Service task 2&quot;)}"></serviceTask>
<serviceTask id="service_task_3" name="service_task_3" activiti:expression="${activitiLogDelegateService.log(&quot;Service task 3&quot;)}"></serviceTask>
<scriptTask id="script_task_3" name="script_task_3" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script><![CDATA[execution.setVariable("test", "test3");]]></script>
</scriptTask>
<scriptTask id="script_task_1" name="script_task_1" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script><![CDATA[execution.setVariable("test", "test1");]]></script>
</scriptTask>
<sequenceFlow id="sid-24377756-3EAD-4694-B697-BEF0D25A5FB1" sourceRef="startEvent1" targetRef="script_task_1"></sequenceFlow>
<sequenceFlow id="sid-5B104683-D970-409A-9498-2D5AE51943CB" sourceRef="script_task_1" targetRef="service_task_1"></sequenceFlow>
<scriptTask id="script_task_2" name="script_task_1" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script><![CDATA[execution.setVariable("test", "test2");]]></script>
</scriptTask>
<sequenceFlow id="sid-123C6871-CE97-4C91-AC9C-30E9CF701467" sourceRef="timer_1" targetRef="script_task_2"></sequenceFlow>
<sequenceFlow id="sid-9008BD10-E4C2-4D56-B5BF-C82BE4714CA3" sourceRef="script_task_2" targetRef="service_task_2"></sequenceFlow>
<sequenceFlow id="sid-727BA009-3FE2-48DE-B41E-693FCE3D2F53" sourceRef="boundary_timer1" targetRef="script_task_3"></sequenceFlow>
<sequenceFlow id="sid-B28BEF79-B67F-4DEF-911C-2605AA5D276E" sourceRef="script_task_3" targetRef="service_task_3"></sequenceFlow>
<sequenceFlow id="sid-CB1A7559-3724-4D70-B54C-B85B7E6B5B36" sourceRef="service_task_3" targetRef="Task4"></sequenceFlow>
<serviceTask id="service_task_4" name="service_task_4" activiti:expression="${activitiLogDelegateService.log(&quot;Service task 4&quot;)}"></serviceTask>
<scriptTask id="script_task_4" name="script_task_4" scriptFormat="groovy" activiti:autoStoreVariables="false">
<script><![CDATA[execution.setVariable("test", "test4");]]></script>
</scriptTask>
<sequenceFlow id="sid-0A636D04-4A39-430E-B72C-962994C99B5F" sourceRef="script_task_4" targetRef="service_task_4"></sequenceFlow>
<sequenceFlow id="sid-EDDDE181-5EDF-427F-A70A-92E5387C610B" sourceRef="Task1" targetRef="script_task_4"></sequenceFlow>
<sequenceFlow id="sid-609A17ED-3924-46F5-912B-CB4686BD6A49" sourceRef="service_task_4" targetRef="Task2"></sequenceFlow>
<serviceTask id="get_timer_value_1" name="get_timer_value_1" activiti:expression="${activitiGetTimerValueDelegateService.getTimerValue(9,1,execution)}"></serviceTask>
<sequenceFlow id="sid-6760A000-AF9B-4BE9-BB76-AEF1FAB94769" sourceRef="service_task_1" targetRef="get_timer_value_1"></sequenceFlow>
<sequenceFlow id="sid-F6843BD0-80EE-479A-83B3-8A37DCA9BB31" sourceRef="get_timer_value_1" targetRef="timer_1"></sequenceFlow>
<serviceTask id="get_timer_value_2" name="get_timer_value_2" activiti:expression="${activitiGetTimerValueDelegateService.getTimerValue(9,1,execution)}"></serviceTask>
<sequenceFlow id="sid-7E6ACD53-4177-4C11-9153-895A47A8379F" sourceRef="service_task_2" targetRef="get_timer_value_2"></sequenceFlow>
<sequenceFlow id="sid-24D7CBC1-C1C6-475E-8314-712C7E97EE42" sourceRef="get_timer_value_2" targetRef="Task1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_MaxShulTest_rlic_2_v5">
<bpmndi:BPMNPlane bpmnElement="MaxShulTest_rlic_2_v5" id="BPMNPlane_MaxShulTest_rlic_2_v5">
<bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
<omgdc:Bounds height="30.0" width="30.0" x="75.0" y="160.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Task1" id="BPMNShape_Task1">
<omgdc:Bounds height="80.0" width="100.0" x="960.0" y="133.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Task4" id="BPMNShape_Task4">
<omgdc:Bounds height="80.0" width="100.0" x="1425.0" y="285.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="Task2" id="BPMNShape_Task2">
<omgdc:Bounds height="80.0" width="100.0" x="1455.0" y="133.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endEvent1" id="BPMNShape_endEvent1">
<omgdc:Bounds height="28.0" width="28.0" x="1703.0" y="189.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ExclusiveGateway1" id="BPMNShape_ExclusiveGateway1">
<omgdc:Bounds height="40.0" width="40.0" x="1600.25" y="183.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="boundary_timer1" id="BPMNShape_boundary_timer1">
<omgdc:Bounds height="31.0" width="31.0" x="992.6419213994196" y="198.41953224936816"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="service_task_1" id="BPMNShape_service_task_1">
<omgdc:Bounds height="71.0" width="110.0" x="330.0" y="139.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timer_1" id="BPMNShape_timer_1">
<omgdc:Bounds height="31.0" width="31.0" x="525.0" y="158.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="service_task_2" id="BPMNShape_service_task_2">
<omgdc:Bounds height="82.0" width="107.0" x="795.0" y="132.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="service_task_3" id="BPMNShape_service_task_3">
<omgdc:Bounds height="82.0" width="107.0" x="1245.0" y="284.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="script_task_3" id="BPMNShape_script_task_3">
<omgdc:Bounds height="80.0" width="100.0" x="1050.0" y="285.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="script_task_1" id="BPMNShape_script_task_1">
<omgdc:Bounds height="80.0" width="100.0" x="150.0" y="135.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="script_task_2" id="BPMNShape_script_task_2">
<omgdc:Bounds height="80.0" width="100.0" x="630.0" y="133.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="service_task_4" id="BPMNShape_service_task_4">
<omgdc:Bounds height="82.0" width="107.0" x="1275.0" y="132.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="script_task_4" id="BPMNShape_script_task_4">
<omgdc:Bounds height="80.0" width="100.0" x="1125.0" y="133.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="get_timer_value_1" id="BPMNShape_get_timer_value_1">
<omgdc:Bounds height="75.0" width="148.0" x="390.0" y="287.5"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="get_timer_value_2" id="BPMNShape_get_timer_value_2">
<omgdc:Bounds height="75.0" width="148.0" x="840.0" y="270.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-9008BD10-E4C2-4D56-B5BF-C82BE4714CA3" id="BPMNEdge_sid-9008BD10-E4C2-4D56-B5BF-C82BE4714CA3">
<omgdi:waypoint x="730.0" y="173.5"></omgdi:waypoint>
<omgdi:waypoint x="795.0" y="173.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-6760A000-AF9B-4BE9-BB76-AEF1FAB94769" id="BPMNEdge_sid-6760A000-AF9B-4BE9-BB76-AEF1FAB94769">
<omgdi:waypoint x="403.6345514950166" y="210.0"></omgdi:waypoint>
<omgdi:waypoint x="444.3156146179402" y="287.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-7E6ACD53-4177-4C11-9153-895A47A8379F" id="BPMNEdge_sid-7E6ACD53-4177-4C11-9153-895A47A8379F">
<omgdi:waypoint x="868.5410447761194" y="214.5"></omgdi:waypoint>
<omgdi:waypoint x="895.669776119403" y="270.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-EDDDE181-5EDF-427F-A70A-92E5387C610B" id="BPMNEdge_sid-EDDDE181-5EDF-427F-A70A-92E5387C610B">
<omgdi:waypoint x="1060.0" y="173.5"></omgdi:waypoint>
<omgdi:waypoint x="1125.0" y="173.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-EAC37DEB-9666-407E-8EE0-27C11CEC4302" id="BPMNEdge_sid-EAC37DEB-9666-407E-8EE0-27C11CEC4302">
<omgdi:waypoint x="1640.25" y="203.5"></omgdi:waypoint>
<omgdi:waypoint x="1703.0" y="203.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-609A17ED-3924-46F5-912B-CB4686BD6A49" id="BPMNEdge_sid-609A17ED-3924-46F5-912B-CB4686BD6A49">
<omgdi:waypoint x="1382.0" y="173.5"></omgdi:waypoint>
<omgdi:waypoint x="1455.0" y="173.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-CB1A7559-3724-4D70-B54C-B85B7E6B5B36" id="BPMNEdge_sid-CB1A7559-3724-4D70-B54C-B85B7E6B5B36">
<omgdi:waypoint x="1352.0" y="325.0"></omgdi:waypoint>
<omgdi:waypoint x="1425.0" y="325.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-24377756-3EAD-4694-B697-BEF0D25A5FB1" id="BPMNEdge_sid-24377756-3EAD-4694-B697-BEF0D25A5FB1">
<omgdi:waypoint x="105.0" y="175.0"></omgdi:waypoint>
<omgdi:waypoint x="150.0" y="175.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-B28BEF79-B67F-4DEF-911C-2605AA5D276E" id="BPMNEdge_sid-B28BEF79-B67F-4DEF-911C-2605AA5D276E">
<omgdi:waypoint x="1150.0" y="325.0"></omgdi:waypoint>
<omgdi:waypoint x="1245.0" y="325.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-727BA009-3FE2-48DE-B41E-693FCE3D2F53" id="BPMNEdge_sid-727BA009-3FE2-48DE-B41E-693FCE3D2F53">
<omgdi:waypoint x="1018.0197154455144" y="225.86437150249057"></omgdi:waypoint>
<omgdi:waypoint x="1066.9219691055694" y="285.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-123C6871-CE97-4C91-AC9C-30E9CF701467" id="BPMNEdge_sid-123C6871-CE97-4C91-AC9C-30E9CF701467">
<omgdi:waypoint x="556.0" y="173.5"></omgdi:waypoint>
<omgdi:waypoint x="630.0" y="173.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-F6843BD0-80EE-479A-83B3-8A37DCA9BB31" id="BPMNEdge_sid-F6843BD0-80EE-479A-83B3-8A37DCA9BB31">
<omgdi:waypoint x="482.93564356435644" y="287.5"></omgdi:waypoint>
<omgdi:waypoint x="533.5134469215401" y="187.33611492008728"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-5B104683-D970-409A-9498-2D5AE51943CB" id="BPMNEdge_sid-5B104683-D970-409A-9498-2D5AE51943CB">
<omgdi:waypoint x="250.0" y="174.86486486486487"></omgdi:waypoint>
<omgdi:waypoint x="330.0" y="174.64864864864865"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-A71A6EB8-293E-4EA7-A876-670C8E4ABF7C" id="BPMNEdge_sid-A71A6EB8-293E-4EA7-A876-670C8E4ABF7C">
<omgdi:waypoint x="1555.0" y="186.51518438177874"></omgdi:waypoint>
<omgdi:waypoint x="1604.380808950086" y="199.36919104991395"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-24D7CBC1-C1C6-475E-8314-712C7E97EE42" id="BPMNEdge_sid-24D7CBC1-C1C6-475E-8314-712C7E97EE42">
<omgdi:waypoint x="940.8656716417911" y="270.0"></omgdi:waypoint>
<omgdi:waypoint x="981.3432835820895" y="213.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-0A636D04-4A39-430E-B72C-962994C99B5F" id="BPMNEdge_sid-0A636D04-4A39-430E-B72C-962994C99B5F">
<omgdi:waypoint x="1225.0" y="173.5"></omgdi:waypoint>
<omgdi:waypoint x="1275.0" y="173.5"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-1691D37B-9B00-452F-B031-124B3845912B" id="BPMNEdge_sid-1691D37B-9B00-452F-B031-124B3845912B">
<omgdi:waypoint x="1522.8189300411523" y="285.0"></omgdi:waypoint>
<omgdi:waypoint x="1609.3596532333645" y="212.60965323336458"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

 

I delpoyed Activiti Explorer (activiti-app) and Activiti Administrator (activiti-admin) to the Tomcat 8.5. I developed test application on the Swing, using Spring 4. Using this application I can move the process instance from one block to another. Here is my java configuration:

@Configuration
@EnableTransactionManagement
public class ActivitiConfig {

@Bean(name = "dataSourceForActiviti", destroyMethod = "close")
public BasicDataSource dataSourceForActiviti() {
return new DataSourceForActiviti();
}

@Bean(name = "transactionManagerForActiviti", destroyMethod = "")
public PlatformTransactionManager transactionManagerForActiviti(@Qualifier("dataSourceForActiviti") DataSource dataSourceForActiviti) {
return new DataSourceTransactionManager(dataSourceForActiviti);
}

@Bean
SpringProcessEngineConfiguration processEngineConfiguration(@Qualifier("dataSourceForActiviti") DataSource dataSourceForActiviti,
@Qualifier("transactionManagerForActiviti") PlatformTransactionManager transactionManagerForActiviti) {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setTransactionManager(transactionManagerForActiviti);

processEngineConfiguration
.setDataSource(dataSourceForActiviti)
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setAsyncExecutorActivate(true)
;

processEngineConfiguration.setDeploymentResources(new Resource[]{
new ClassPathResource("bpm/MaxShulTest_rlic.bpmn20.xml")
});


return processEngineConfiguration;
}

@Bean
ProcessEngineFactoryBean processEngineFactoryBean(SpringProcessEngineConfiguration processEngineConfiguration) {
ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration);
return processEngineFactoryBean;
}

@Bean
RepositoryService repositoryService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getRepositoryService();
}

@Bean
RuntimeService runtimeService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getRuntimeService();
}

@Bean
TaskService taskService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getTaskService();
}

}

In my app I use the posgresql database for the Activiti Engine. And the same database (and the same scheme) is written in the activiti-app.properties for activiti-app.

 

When activiti-app (Activiti Explorer) is running and my app is running, and I move some process instance in my app, errors occurs with service tasks that go after timers. After timer fired, errors occurs with the description: "couldn't instantiate MyClass", or with the description: "Could not execute service task expression" (if I used spring beans in the expression to the service task).
How to resolve this problem?

 

PS I am using Activiti 6.0.0.

Outcomes