Reputation: 2339
I am trying to invoke a method from activiti sequence flow but I am getting the below error, can someone please help me fix this issue?
<sequenceFlow id="finalTask" name="finalTask" sourceRef="chargeAccount" targetRef="theEnd">
<extensionElements>
<activiti:executionListener
expression="${EscalationListener.escalate(execution, 'kermit')}"
event="end" />
</extensionElements>
</sequenceFlow>
Error:
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'EscalationListener' at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:8
Java code:
import org.activiti.engine.HistoryService;
import org.activiti.engine.delegate.DelegateExecution;
public class EscalationListener {
HistoryService historyService;
public void escalate(DelegateExecution execution, String otherTaskId)
throws Exception {
historyService.createHistoricTaskInstanceQuery().taskOwner(otherTaskId)
.finished();
//System.out.println("called history service" + otherTaskId);
// do some stuff with the task
}
}
Upvotes: 1
Views: 10067
Reputation: 1269
<activiti:executionListener
expression="${EscalationListener.escalate(execution, 'kermit')}"
event="end" />
try to change EscalationListener
per escalationListener
here. I had problems sometimes because of this sometimes.
Sadly this PropertyNotFoundException: Cannot resolve identifier
happens quite a lot when you have errors. And at least for me, it's not helping you...
Upvotes: 0
Reputation: 767
You need to add EscalationListener
as a process variable :
runtimeService.setVariable(yourExecutionId, "escalationListener" , new EscalationListener());
You can also add process variable before starting the process:
runtimeService.startProcessInstanceByKey("someKey", processVariables);
processVariables is a Map<String, Object>
where you put EscalationListener
object
or declare it as Spring bean to access it in process definition:
<bean id="EscalationListener" class="com.test.activiti.listener.EscalationListener" >
Upvotes: 4