cancel
Showing results for 
Search instead for 
Did you mean: 

Error deploying activiti process with Service Task

jcuzcano
Champ in-the-making
Champ in-the-making
Hi Activiti Team

I have an Activiti project that was created using Spring, Hibernate and Mysql and I want deploy this project with Activiti Probe and execute the process with Activiti Explorer, for this I have created a application.bar, this file only include my bmpn20.xml and other file application.jar with the spring-context.xml, hbm, classes and this file was included into activiti-rest lib, but when I try run the process with Explorer, the application showing this exception.

00070001 Wrapped Exception (with status template): Unknown property used in expression

in the log:

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

this bean was created in the spring-context, I understand that the spring context was not loaded.

What steps are necessary in order to complete this deploy.

Thanks for your response.
5 REPLIES 5

frederikherema1
Star Contributor
Star Contributor
Hi,

How exactly do you have your spring-context loaded? The default behaviour of the REST-webapp is to read the activiti.cfg.xml's on the classpath and use this engine. If you want it to use your engine (configured in spring, together with your sping-beans) you should als a ServletContextListener that loads the spring-context.

If you define a process-engine in your spring-context.xml, it will be registered with the static class "ProcessEngines", which activiti-rest (and indirectly probe and explorer) consults to get a process engine to use.

starmage
Champ in-the-making
Champ in-the-making
Hi,

i have also that kind of problems.
Here is my spring configuration:



<?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-3.0.xsd">

    <bean id="processHelperBean" class="de.mycompany.beans.ProcessHelperBean"/>

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

    <bean id="transactionDataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
        <property name="targetDataSource" ref="dataSource"/>
    </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="transactionDataSource" />
    </bean>

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="databaseType" value="mysql" />
        <property name="dataSource" ref="dataSource" />
        <property name="transactionManager" ref="transactionManager" />
        <property name="databaseSchemaUpdate" value="true" />
        <property name="jobExecutorActivate" value="false" />
        <property name="deploymentResources" value="classpath*:/process/*.bpmn20.xml" />
    </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" />
    <bean id="formService" factory-bean="processEngine" factory-method="getFormService" />

    <bean id="workflowManager" class="de.mycompany.service.WorkflowManager">
        <property name="repositoryService" ref="repositoryService" />
        <property name="runtimeService" ref="runtimeService" />
        <property name="taskService" ref="taskService" />
        <property name="historyService" ref="historyService" />
        <property name="managementService" ref="managementService" />
        <property name="identityService" ref="identityService" />
        <property name="formService" ref="formService" />
        <property name="persistenceManager" ref="persistenceManager" />
    </bean>

</beans>


In my BPMN xml i want to call this line:

<serviceTask id="DEACTIVATED" activiti:expression="${processHelperBean.setStatus('DEACTIVATED')}" />

But i ran into this Exception:

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

Could anyone give me a hint ?! Thank you.

greetz, ralf

jbarrez
Star Contributor
Star Contributor
Ralf, that should just work. Are you sure you are using the process engine from your spring config? How are you obtaining it ?

partizano
Champ in-the-making
Champ in-the-making
Hi,

I have similar problem, my exception is "05060000 Wrapped Exception (with status template): Unknown property used in expression"

My process is:
 
  <process id="MyProcess" name="myProcess">
    <documentation>Place documentation for the 'myProcess' process here.</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <endEvent id="endevent1" name="End"></endEvent>
    <serviceTask id="servicetask1" name="Create JPA object" activiti:expression="loanRequestBean.newLoanRequest()" activiti:resultVariableName="loanRequest"></serviceTask>
    <userTask id="usertask1" name="object property is ${loanRequest.customerName}" activiti:assignee="spec"></userTask>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="servicetask1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
  </process>

I took beans from examples in the user guid and made little changes in LoanRequestBean class:

public class LoanRequestBean  {

  @PersistenceContext
  private EntityManager entityManager;

  @Transactional
  public LoanRequest newLoanRequest() {
    LoanRequest lr = new LoanRequest();
    lr.setCustomerName("simple name");
    entityManager.persist(lr);
    return lr;
  }
 
  public LoanRequest getLoanRequest(Long id) {
   return entityManager.find(LoanRequest.class, id);
  }
}

@Entity(name = "SPRING_TEST_ORDER")
public class LoanRequest {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "ID_")
  private Long id;

  @Column(name = "CUSTOMER_NAME_")
  private String customerName;

  @Column(name = "AMOUNT_")
  private Long amount;

  @Column(name = "APPROVED_")
  private boolean approved;

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

}

My activiti.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       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
                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                           http://www.springframework.org/schema/tx      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

  <context:component-scan base-package="com.mycompany.beans"/>

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="org.h2.Driver" />
    <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
    <property name="username" value="sa" />
    <property name="password" value="" />
     <property name="defaultAutoCommit" value="false" />
  </bean>
 
  <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="false"/>
  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory"/>
  </bean>
 
  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
     <property name="persistenceXmlLocation">
      <value>classpath:/com/mycompany/beans/persistence.xml</value>
    </property>
    <property name="jpaVendorAdapter">
      <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
        <property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.H2Dictionary" />
      </bean>
    </property>
  </bean>
 
  <bean id="loanRequestBean" class="com.mycompany.beans.LoanRequestBean">
  </bean>
 
  <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="jpaEntityManagerFactory" ref="entityManagerFactory" />
    <property name="jpaHandleTransaction" value="false" />
    <property name="jpaCloseEntityManager" value="false" />
    <property name="jobExecutorActivate" value="false" />
  </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" />

</beans>

persistence.xml:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
     version="1.0"
>
  <persistence-unit name="activiti-jpa-pu">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
   
    <class>com.mycompany.beans.LoanRequest</class>   
   
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
   
     <properties>
      <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
      <property name="openjpa.LockTimeout " value="30000"/>
      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add,deleteTableContents')"/>
    </properties>
   
  </persistence-unit>
</persistence>

I have generated jar and put it into c:\Activity\apps\apache-tomcat-6.0.32\webapps\activiti-rest\WEB-INF\lib\. Jar has follow structure:
..
–com
—-mycompany
——beans
——activiti.cfg.xml
——LoanRequest.class
——LoanRequestBean.class
——persistence.xml
–META-INF
—-MANIFEST.MF

I try tu run the process from Activity Explorer and get exception "05060000 Wrapped Exception (with status template): Unknown property used in expression".

What's my mistake?


Thanks, Alexander.

trademak
Star Contributor
Star Contributor
Hi,

The spring configuration in your JAR file should be placed in a file named activiti-context.xml.
You should create the activiti-context.xml file in the WEB-INF/classes directory of the activiti-rest application.
Then you should remove the activiti-cfg.jar file from the WEB-INF/lib directory.
Now the Activiti engine will be created based on your Spring configuration.

Best regards,