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.
http://forums.activiti.org/content/how-save-process-variables-custom-database

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-127.0.0.1-8080-4) Error while closing command context: org.activiti.engine.ActivitiException: Unknown property used in expression: ${systemSpecificationCheck}
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53) [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute(ServiceTaskDelegateExpressionActivityBehavior.java:65) [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44) [activiti-engine-5.12.jar:5.12]
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:86) [activiti-engine-5.12.jar:5.12]


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

The class looks like:

@Named
@SessionScoped
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);
      logger.info("[ACT] SpecificationCheck is running", this);
      try {
         // GET THE NEEDED VALUES FROM THE ENGINE
         String processInstanceId = execution.getProcessInstanceId();
         logger.info("[ACT] ProcessInstanceId = " +processInstanceId, this);
         //TaskService taskService = execution.getEngineServices()
         //      .getTaskService();
         Task t = taskService.createTaskQuery()
               .processInstanceId(processInstanceId).singleResult();
         logger.info("[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.

Outcomes