Hallo everyone,
I am having the following error when I try to start a process with a service task, which queries (makes a select all) a table in the database:
The process could not be started. : Cannot instantiate process definition queryProcess:1:2d82e964-0091-11e5-8387-000c292d6323: Unknown property used in expression: #{priorityService.retrieveAll()}. Cause: Cannot resolve identifier 'priorityService'
After hours of searching, I couldn't find the problem.
I assume that the bpmn code is written correctly, here is a part of the bpmn code:
<bpmn2:process id="queryProcess" name="Hibernate Priority Test" isExecutable="true">
<bpmn2:serviceTask id="QueryServiceTask" camunda:expression="#{priorityService.retrieveAll()}" name="Query MySql Database"> ...
also I think the persistence file is correct:
<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" version="1.0">
<persistence-unit name="priority-service-jta" transaction-type="JTA">
<jta-data-source>java:/mysql</jta-data-source>
<jar-file>lib/HibernateEntities.jar</jar-file>
<class>com.step2e.bean.Priority</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>
It is worthy to not that the entities are packaged in a .jar file with the DAO and the Sevice class.
This is the interface service:
@Local
public interface IPriorityService {
void persist(Priority priority);
Priority retrieve();
List<Priority> retrieveAll();
void delete(Priority prio);
}
and some code of the business Logic implementing the above interface:
@Stateless
@Named
public class PriorityService implements IPriorityService {
@PersistenceContext(unitName = "priority-service-jta")
private EntityManager manager = null;
public PriorityService() {
// default constructor
}
public PriorityService(EntityManager em) {
this.manager = em;
}
public void persist(Priority priority) {
this.manager.persist(priority);
}
I think that there is a dependency problem in the pom.xml, which is the following:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="
http://maven.apache.org/POM/4.0.0"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.step2e</groupId>
<artifactId>entitymanager</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-bom</artifactId>
<version>7.2.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.8.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.8.Final</version>
</dependency>
<dependency>
<groupId>com.step2e</groupId>
<artifactId>entities</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
<!-- camunda engine dependency -->
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
<scope>provided</scope>
<version>7.2.0</version>
</dependency>
<!-- camunda cdi beans -->
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-cdi</artifactId>
<version>7.2.0</version>
</dependency>
<!-- provides a default EjbProcessApplication -->
<dependency>
<groupId>org.camunda.bpm.javaee</groupId>
<artifactId>camunda-ejb-client</artifactId>
<version>7.2.0</version>
</dependency>
<!-- Java EE 6 Specification -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<version>3.0.2.Final</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>xalan</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<finalName>camunda-priority</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
I would be grateful if you can help to solve this issue.
Best Regards,
Mireilla