Classes not found when boundary timer event triggered

cancel
Showing results for 
Search instead for 
Did you mean: 
sadiasher
Member II

Classes not found when boundary timer event triggered

I applied boundary timer event on user task, I added java class on service task class attribute but when a timer expired and triggered list of exceptions throws i.e class assigned to service task cannot found. although class exist on the class path. asyncExecutorActivate property is also enabled in activiti configuration

here is a code

BPMN

<?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" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="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="timertest" name="timertest" isExecutable="true">
<startEvent id="startEvent1"></startEvent>
<userTask id="sid-9F95F9B8-6C5C-4221-B3A7-3BD2BAEC22CA"></userTask>
<sequenceFlow id="sid-08270597-3D34-4CFD-BACF-CB95036CBC48" sourceRef="startEvent1" targetRef="sid-9F95F9B8-6C5C-4221-B3A7-3BD2BAEC22CA"></sequenceFlow>
<boundaryEvent id="sid-5AC91A08-17CC-4F6E-ABC2-2B8AF63EAB66" attachedToRef="sid-9F95F9B8-6C5C-4221-B3A7-3BD2BAEC22CA" cancelActivity="true">
<timerEventDefinition>
<timeDate>${expiresOn}</timeDate>
</timerEventDefinition>
</boundaryEvent>
<endEvent id="sid-1D6E7697-6ECA-42BA-98E5-BE089A78DCF2"></endEvent>
<sequenceFlow id="sid-A4C68C9C-38C3-43A9-BB3F-83FABACA65F9" sourceRef="sid-CE624FA0-9F7E-4FF9-BF3E-C016D046A3BF" targetRef="sid-1D6E7697-6ECA-42BA-98E5-BE089A78DCF2"></sequenceFlow>
<serviceTask id="sid-CE624FA0-9F7E-4FF9-BF3E-C016D046A3BF" activiti:class="com.softech.workflowengine.workflow.policyack.servicetask.TimerClass"></serviceTask>
<sequenceFlow id="sid-799456B9-F667-4E98-A856-E1AA7B79F680" sourceRef="sid-5AC91A08-17CC-4F6E-ABC2-2B8AF63EAB66" targetRef="sid-CE624FA0-9F7E-4FF9-BF3E-C016D046A3BF"></sequenceFlow>
<endEvent id="sid-705703CA-B642-435C-8393-B236EC3E964B"></endEvent>
<sequenceFlow id="sid-010B8977-34F9-40F4-B694-D56D5BA34257" sourceRef="sid-9F95F9B8-6C5C-4221-B3A7-3BD2BAEC22CA" targetRef="sid-705703CA-B642-435C-8393-B236EC3E964B"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_timertest">
<bpmndi:BPMNPlane bpmnElement="timertest" id="BPMNPlane_timertest">
<bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
<omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-9F95F9B8-6C5C-4221-B3A7-3BD2BAEC22CA" id="BPMNShape_sid-9F95F9B8-6C5C-4221-B3A7-3BD2BAEC22CA">
<omgdc:Bounds height="80.0" width="100.0" x="175.0" y="138.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-5AC91A08-17CC-4F6E-ABC2-2B8AF63EAB66" id="BPMNShape_sid-5AC91A08-17CC-4F6E-ABC2-2B8AF63EAB66">
<omgdc:Bounds height="31.0" width="31.0" x="253.59371010330312" y="202.75947444214634"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-1D6E7697-6ECA-42BA-98E5-BE089A78DCF2" id="BPMNShape_sid-1D6E7697-6ECA-42BA-98E5-BE089A78DCF2">
<omgdc:Bounds height="28.0" width="28.0" x="405.0" y="311.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-CE624FA0-9F7E-4FF9-BF3E-C016D046A3BF" id="BPMNShape_sid-CE624FA0-9F7E-4FF9-BF3E-C016D046A3BF">
<omgdc:Bounds height="80.0" width="100.0" x="210.0" y="285.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-705703CA-B642-435C-8393-B236EC3E964B" id="BPMNShape_sid-705703CA-B642-435C-8393-B236EC3E964B">
<omgdc:Bounds height="28.0" width="28.0" x="320.0" y="164.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-A4C68C9C-38C3-43A9-BB3F-83FABACA65F9" id="BPMNEdge_sid-A4C68C9C-38C3-43A9-BB3F-83FABACA65F9">
<omgdi:waypoint x="310.0" y="325.0"></omgdi:waypoint>
<omgdi:waypoint x="405.0" y="325.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-799456B9-F667-4E98-A856-E1AA7B79F680" id="BPMNEdge_sid-799456B9-F667-4E98-A856-E1AA7B79F680">
<omgdi:waypoint x="269.5937101033031" y="234.75947444214634"></omgdi:waypoint>
<omgdi:waypoint x="269.5937101033031" y="259.3797372210732"></omgdi:waypoint>
<omgdi:waypoint x="260.0" y="259.3797372210732"></omgdi:waypoint>
<omgdi:waypoint x="260.0" y="285.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-08270597-3D34-4CFD-BACF-CB95036CBC48" id="BPMNEdge_sid-08270597-3D34-4CFD-BACF-CB95036CBC48">
<omgdi:waypoint x="130.0" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="175.0" y="178.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-010B8977-34F9-40F4-B694-D56D5BA34257" id="BPMNEdge_sid-010B8977-34F9-40F4-B694-D56D5BA34257">
<omgdi:waypoint x="275.0" y="178.0"></omgdi:waypoint>
<omgdi:waypoint x="320.0" y="178.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

Java Delegate

package com.softech.workflowengine.workflow.policyack.servicetask;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

public class TimerClass implements JavaDelegate{

@Override
public void execute(DelegateExecution execution) {
System.out.println(">> in TimerClass ");
}
}

Exception

07:56:03,977 [activiti-async-job-executor-thread-2] ERROR org.activiti.engine.impl.interceptor.CommandContext - Error while closing command context
org.activiti.engine.ActivitiException: couldn't instantiate class com.softech.workflowengine.workflow.policyack.servicetask.TimerClass
at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:137)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.defaultInstantiateDelegate(ClassDelegate.java:306)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.instantiateDelegate(ClassDelegate.java:295)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.getActivityBehaviorInstance(ClassDelegate.java:273)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:217)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:180)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:131)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:89)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:55)
at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:73)
at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:57)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:42)
at org.activiti.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:48)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:63)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:29)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:44)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:39)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:97)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.activiti.engine.ActivitiClassLoadingException: Class not found: com.softech.workflowengine.workflow.policyack.servicetask.TimerClass
at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:87)
at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:134)
... 24 more
Caused by: java.lang.ClassNotFoundException: com.softech.workflowengine.workflow.policyack.servicetask.TimerClass
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:288)
at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:68)
... 25 more
07:56:04,000 [activiti-async-job-executor-thread-2] ERROR org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable - Job 130011 failed
org.activiti.engine.ActivitiException: couldn't instantiate class com.softech.workflowengine.workflow.policyack.servicetask.TimerClass
at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:137)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.defaultInstantiateDelegate(ClassDelegate.java:306)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.instantiateDelegate(ClassDelegate.java:295)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.getActivityBehaviorInstance(ClassDelegate.java:273)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:217)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:180)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:131)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:89)
at org.activiti.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:55)
at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:73)
at org.activiti.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:57)
at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:42)
at org.activiti.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:48)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:63)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:29)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:44)
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:39)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.executeJob(ExecuteAsyncRunnable.java:97)
at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:75)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Even in my another workflow i assigned spring bean to service task in delegate attribute but getting same exceptions. I work on latest activti version 

1 Reply
sadiasher
Member II

Re: Classes not found when boundary timer event triggered

The classes need to be executed after the timer expired must be on tomcat's classpath (in tomcat's lib folder). For more reference please see article

https://dzone.com/articles/tutorial-devoxx-activiti-bpmn