AnsweredAssumed Answered

Unknown property used in expression -- Cannot resolve identifier 'departmentHeadUserTask'

Question asked by sdwilly22 on Jun 10, 2013
Latest reply on Jun 12, 2013 by sdwilly22
I have activiti explorer 5.9 running on a tomcat instance inside eclipse. I am exporting my classes into a jar file and putting that in the WEB-INF/lib folder of the tomcat instance. I am getting the following error messages.

Caused by: org.activiti.engine.ActivitiException: Unknown property used in expression
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:55)
   at org.activiti.engine.impl.bpmn.listener.ExpressionTaskListener.notify(ExpressionTaskListener.java:33)
   at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:512)
   … 140 more
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'departmentHeadUserTask'
   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.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)


Here are the contents of my applicationContext.xml.

<blockcode>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:jee="http://www.springframework.org/schema/jee"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">





   <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="false" />
      <property name="customFormTypes">
         <list>
            <ref bean="userFormType" />
         </list>
      </property>
      <property name="customSessionFactories">
         <list>
            <bean class="org.bpmnwithactiviti.chapter10.ldap.LDAPUserManagerFactory">
               <constructor-arg ref="ldapConnectionParams" />
            </bean>
            <bean class="org.bpmnwithactiviti.chapter10.ldap.LDAPGroupManagerFactory">
               <constructor-arg ref="ldapConnectionParams" />
             </bean>
          </list>
      </property>
      <property name="deploymentResources" value="classpath*:GroupConferenceAttendanceRequest.bpmn20.xml" />
      <property name="history" value="full" />
   </bean>

   <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
      <property name="processEngineConfiguration" ref="processEngineConfiguration" />
   </bean>





   <bean id="departmentHeadUserTask" class="org.bpmnwithactiviti.chapter6.listener.DepartmentHeadUserTask" />

</beans>
</blockcode>

Here is the code from my process GroupConferenceAttendanceRequest.bpmn20.xml

<blockcode>

<userTask id="usertask2" name="Department Approval" activiti:assignee="hd.connor" activiti:formKey="ConferenceAttendanceForm">
      <extensionElements>
     <activiti:taskListener expression="${departmentHeadUserTask.assignDeptHeadTask(task, task.eventName)}" event="assignment" />
     <activiti:taskListener expression="${departmentHeadUserTask.assignDeptHeadTask(task, task.eventName)}" event="create" />
   …
</blockcode>


I have tried so many things to get this working without the a good result. I saw on another forum post that. The bean would be registered  when…

when using a SpringProcessEngineConfiguration AND a ProcessEngineFactoryBean in your application-context AND you don't specify a "beans" property on the SpringProcessEngineConfiguration, ALL spring-beans will be available in expressions.

But this did not seem to be the case. I also tried making a property called "beans" inside the processEngineConfiguration like this    
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="beans"> <map> <entry key="departmentHeadUserTask" value-ref="departmentHeadUserTask" /> </map> </property>

</bean>

but that did not register the bean for use in the expression language.  I have verified that the jar file contains the class I am referencing. Other classes in that jar file are working fine. Can anyone spot how my configuration is not correct?

Outcomes