AnsweredAssumed Answered

Activiti unable to reference Spring beans.

Question asked by unsavory on Jul 27, 2011
Latest reply on Jul 27, 2011 by unsavory
I am attempting to access a spring bean using the following expression:
<conditionExpression xsi:type="tFormalExpression">${ userService.isAutoRejectCandidate(userService.getUserByEmail(email)) }</conditionExpression>

But the following exception is thrown when doing so:
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'userService'
   at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
   at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:79)
   at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75)
   at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
   at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
   at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:46)
   … 166 more

Here is my Spring configuration:
<!–
   ~~~~~~~~~~~~~~~~~~  ACTIVITI BPM  ~~~~~~~~~~~~~~~~~~
   –>
   
   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="databaseSchemaUpdate" value="true" />
      <property name="jobExecutorActivate" value="true" />
      <property name="deploymentResources" value="classpath*:/seah/bpm/*.bpmn20.xml" />
   </bean>
 
   <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
      <property name="processEngineConfiguration" ref="processEngineConfiguration" />
   </bean>
 
   <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
   <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
   <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
   <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
   <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
   <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />

I should not that userService is a spring bean in my Spring application context configured via the @Service annotation. 

This is how I use/reference Activiti in my application:
@Resource
   private ContractRepository contractRepository;
   
   @Resource
   private RepositoryService repositoryService;
   
   @Resource
   private RuntimeService runtimeService;
   
   @Resource
   private TaskService taskService;
   
   @Resource
   private HistoryService historyService;
      
   @Resource
   private IdentityService identityService;

Any ideas why Activiti cannot see my Spring beans?

Outcomes