AnsweredAssumed Answered

activiti:delegateExpression= throws --> error Cannot resolve identifier

Question asked by cweber on Jun 28, 2013
Latest reply on Jul 1, 2013 by jbarrez
Hi everybody,

I think my problem is simmilar to the one sherlock described in this post.

I want to call cdi beans from an service task execution but i get the following error at runtime.

13:38:14,132 ERROR [org.activiti.engine.impl.interceptor.CommandContext] (http-localhost- Error while closing command context: org.activiti.engine.ActivitiException: Unknown property used in expression: ${systemSpecificationCheck}
   at org.activiti.engine.impl.el.JuelExpression.getValue( [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute( [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute( [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation( [activiti-engine-5.12.jar:5.12]

For me it looks like the engine did not find my SystemSpecificationCheck class.

The class looks like:

public class SystemSpecificationCheck implements JavaDelegate, Serializable{

   private static final long serialVersionUID = 1L;
   private Logger logger;
   @Inject private TaskService taskService;

   public void execute(DelegateExecution execution) throws Exception {
      logger = LoggerFactory.getLogger(SystemSpecificationCheck.class);"[ACT] SpecificationCheck is running", this);
      try {
         String processInstanceId = execution.getProcessInstanceId();"[ACT] ProcessInstanceId = " +processInstanceId, this);
         //TaskService taskService = execution.getEngineServices()
         //      .getTaskService();
         Task t = taskService.createTaskQuery()
               .processInstanceId(processInstanceId).singleResult();"[ACT] Task ="+t.getName(),this);

From the other post I saw that i have to use the activiti:delegateExpression instead of class. Thats why my TaskService looks like this.

  <serviceTask id="abc" name="Spezifizierung nötig?" activiti:delegateExpression="${systemSpecificationCheck}"></serviceTask>

And I used

CdiJtaProcessEngineConfiguration processEngineConfiguration = new CdiJtaProcessEngineConfiguration();

My CDI Beans are working well in my JSF part and I can run the process without CDI Injection but if I try to Inject a bean (even the standard TaskService) it fails.

Have anyone an idea what I do wrong and how I can enable CDI Injection in the service task execution?
Thanks for help.