Hi everyone i tried CDI with Activiti but i keep getting this error :
Unknown property used in expression: #{bookOrder.validates()}
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'bookOrder'
My BookOrder class :
@Named("bookOrder")
public class BookOrder {
private static final long serialVersionUID = 1L;
private String isbn;
private boolean approved;
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public boolean isApproved() {
return approved;
}
public void setApproved(boolean approved) {
this.approved = approved;
}
public void validates() {
System.out.println("Testing the CDI ...");
}
}
and the BPMN file :
<?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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsmgdi="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-process" name="bookorder">
<startEvent id="startEvent" name="Start" activiti:formKey="taskForm_newOrder.jsf" />
<sequenceFlow id="toValidateTask" sourceRef="startEvent" targetRef="validateTask"/>
<serviceTask id="validateTask" activiti:expression="#{bookOrder.validates()}" />
<sequenceFlow id="toCompletedOrderTask" sourceRef="validateTask" targetRef="completeOrderTask"/>
<userTask id="completeOrderTask" name="Complete order" activiti:assignee="kermit" activiti:formKey="taskForm_completeOrder.jsf">
<documentation>Completing order for book with isbn </documentation>
</userTask>
<sequenceFlow id="toApproveTask" sourceRef="completeOrderTask" targetRef="approveTask"/>
<serviceTask id="approveTask" activiti:expression="#{bookOrder.validates()}" />
<sequenceFlow id="toEndEvent" sourceRef="approveTask" targetRef="endEvent"/>
<endEvent id="endEvent" name="End"/>
</process>
</definitions>
Any ideas what i'm doing Wrong here ??
I solved the problem i'm using spring with JSF i declared the beans in my activiti.cfg.xml , the problem i'm facing is that inside the validate method i have bookOrder.getIsbn when i call it it retrieves the value i want but when processing it vial ServiceTask it always retrievs NullPointerException
<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
">
<bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti_test" />
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUsername" value="root" />
<property name="jdbcPassword" value=" " />
<property name="databaseSchemaUpdate" value="DB_SCHEMA_UPDATE_TRUE" />
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
<property name="asyncExecutorEnabled" value="true" />
<property name="asyncExecutorActivate" 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"/>
<bean id="bookOrder" class="ma.net.s2m.selectsystem.web.controller.admin.BookOrder"/>
<bean id="operationController" class="ma.net.s2m.selectsystem.web.controller.admin.OperationController"/>
<bean id="adminModele" class="ma.net.s2m.selectsystem.web.modele.AdminModele"/>
<bean id="moduleMenuItem" class="ma.net.s2m.selectsystem.domainmodel.admin.ModuleMenuItem"/>
</beans>
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.