AnsweredAssumed Answered

PropertyNotFoundException: Cannot resolve identifier

Question asked by shukla.raghav on Oct 13, 2012
Latest reply on Apr 6, 2015 by arihant.banthia
I am using demo setup.

Here is my test Process
[img]http://localhost:8080/activiti-explorer/APP/13/MyFirstProcessDiagram.my_test_process.png[/img]

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="my_test_process" name="MyTestProcess">
    <startEvent id="startevent1" name="Start" activiti:initiator="kermit"></startEvent>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <userTask id="details" name="Enter Details" activiti:assignee="kermit" activiti:candidateUsers="fozzie">
      <documentation>This is a Test Form Documentation 2</documentation>
      <extensionElements>
        <activiti:formProperty id="user_name" name="Name" type="string"></activiti:formProperty>
        <activiti:formProperty id="salary" name="salary" type="long"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <userTask id="usertask4" name="Gold Member" activiti:assignee="kermit" activiti:candidateUsers="fozzie">
      <documentation>This is documentation for Gold Member</documentation>
    </userTask>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <endEvent id="endevent1" name="End"></endEvent>
    <serviceTask id="servicetask1" name="Platinum Member" activiti:expression="#{platinum.doSomething()}"></serviceTask>
    <sequenceFlow id="flow2" name="" sourceRef="details" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow3" name="salary_flow_a" sourceRef="exclusivegateway1" targetRef="servicetask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary > 2000}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="startevent1" targetRef="details"></sequenceFlow>
    <sequenceFlow id="flow5" name="salary_flow_b" sourceRef="exclusivegateway1" targetRef="usertask4">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${salary <= 2000}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow6" name="" sourceRef="usertask4" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow7" name="" sourceRef="servicetask1" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow8" name="" sourceRef="exclusivegateway2" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_my_test_process">
    …
    …
    …
  </bpmndi:BPMNDiagram>
</definitions>

a) I create  the deployment artifacts in eclipse (.bar file + .jar file containing the .class for com.osr.test.PlatinumService ).
b) Since i was not sure where to copy the jar in the Demo Setup. Many of the post discussed putting the JAR file to activiti-XXX\WEB-INF\lib folder, some of the posts discuss putting the jar into activiti-explorer\WEB-INF\lib and also activiti-rest\WEB-INF\lib. I got a little confused so i added the jar to all the following locations
   
   - C:\activiti-5.9\apps\apache-tomcat-6.0.32\lib.
   - C:\activiti-5.9\apps\apache-tomcat-6.0.32\lib
   - C:\activiti-5.9\apps\apache-tomcat-6.0.32\webapps\activiti-explorer\WEB-INF\lib
   - C:\activiti-5.9\apps\apache-tomcat-6.0.32\webapps\activiti-rest\WEB-INF\lib
   - C:\activiti-5.9\setup\build\webapps\activiti-explorer.war\WEB-INF\lib
   - C:\activiti-5.9\setup\build\webapps\activiti-rest.war\WEB-INF\lib      

Where should we put the JAR ?

c) Modified the activiti.cfg.xml in C:\activiti-5.9\setup\build\activiti-cfg to add a custom bean 'platinum'
   
   
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
 
    <!– Database configurations –>
    <property name="databaseSchemaUpdate" value="true" />
    <property name="jdbcUrl" value="jdbc:h2:tcp://localhost/activiti" />
    <property name="jdbcDriver" value="org.h2.Driver" />
    <property name="jdbcUsername" value="sa" />
    <property name="jdbcPassword" value="" />
   
    <property name="jobExecutorActivate" value="true" />
   
  </property>

  </bean>
   <bean id="platinum" class="com.osr.test.PlatinumService"/>
</beans>

I noticed that the modified activiti.cfg.xml was overridden by original one everytime i started the server, so the custom bean was removed. So i made a small modification in build.xml. Changed the value of overwrite attribute to false.

<copy todir="${activiti.home}/setup/build/activiti-cfg" overwrite="false">

c) Deployed the .bar file in activiti-explorer

d) started the application using

c:\activiti-5.9\setup> ant demo.start

and signed in using kermit/kermit. Started my process from processes tab to view the Form showing two input fields for entering Name and Salary. But as soon as i complete the form i get error with following root cause

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'platinum'

Why the activiti engine cannot find my jar to locate the class file for identifier 'platinum' ? What could be the problem, i am struggling since last 3 days.

Outcomes