The process could not be started. : Cannot instantiate process definition ...

1,785 views
Skip to first unread message

mireill...@gmail.com

unread,
May 26, 2015, 3:05:58 AM5/26/15
to camunda-...@googlegroups.com
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

mireill...@gmail.com

unread,
May 26, 2015, 3:07:47 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Just for correction:

It is worthy to note that the entities are packaged in a .jar file *WITHOUT* the DAO and the Sevice class.

thank you

Ronny Bräunlich

unread,
May 26, 2015, 3:16:50 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Mireilla,

could you possibly show us how you configured your ProcessEngine, too?

Cheers,
Ronny

mireill...@gmail.com

unread,
May 26, 2015, 8:17:08 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Ronny,

the engine configuration inside my standalone.xml looks like this:

<process-engines>
<process-engine default="true" name="default">
<datasource>java:/mysql</datasource>
<history-level>audit</history-level>
<configuration>org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration</configuration>
<properties>
<property name="autoStoreScriptVariables">true</property>
</properties>
<plugins>
<plugin>
<class>org.camunda.bpm.engine.impl.plugin.AdministratorAuthorizationPlugin</class>
<properties>
<property name="administratorUserName">admin</property>
</properties>
</plugin>
<plugin>
<class>org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin</class>
</plugin>
<plugin>
<class>org.camunda.spin.plugin.impl.SpinProcessEnginePlugin</class>
</plugin>
</plugins>
</process-engine>
</process-engines>

I run WildFly 8.2.0.Final on a Ubuntu Server installation and I think my engine is configured as embedded.

I tried the following steps to find out where the mistake could be:
- moved my entity from a separate .jar file to the same project
- tried to implement JavaDelegate and used delegate expression instead of normal expression
Unfortunately without any success


Thanks for your help,
Mireilla

Ronny Bräunlich

unread,
May 26, 2015, 8:36:46 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Mireilla,

just one additional question to be sure: your WAR contains a beans.xml inside its WEB-INF directory?

Cheers,
Ronny

mireill...@gmail.com

unread,
May 26, 2015, 8:58:38 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Exactly, the WEB-INF/beans.xml is existing but atm no data inside. Looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all">

</beans>

I read about doing some mapping inside but it was Spring related and didn't solve the problem so I cleaned it up again.
Is there something missing / wrong) ?

Cheers,
Mireilla

Ronny Bräunlich

unread,
May 26, 2015, 9:16:18 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Mireilla,

an empty beans.xml should be fine.
Could you please provide us with the log from the startup of your Wildfly server?
We would like to check if there's something unusual to see.

Cheers,
Ronny

Mireilla Smith

unread,
May 26, 2015, 9:26:45 AM5/26/15
to Ronny Bräunlich, camunda-...@googlegroups.com
Hi Ronny, 

this is the output I get when I start WildFly. 

Thanks for your help, 
Mireilla
wildfly-startup.log

Ronny Bräunlich

unread,
May 26, 2015, 9:54:37 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Mireilla,

what I see from your server.log is:
  • your process is part of "camunda-ap.war"
  • the EJB is part of "camunda-mh.war"
  • both WARs are deployed separately and not part of one big EAR
Based on this information I suppose that the CdiELResolver cannot resolve the "priorityService" because it is part of a different deployment.
Usually the CDI BeanManager only covers one deployment (one WAR in this case) and doesn't "connect" different applications.
Also, your EJB is only annotated with @Local and therefore camunda-ap shouldn't be able to access it.
Could you please try to move the EJB and the process application inside one WAR and see if that works?

Cheers,
Ronny

mireill...@gmail.com

unread,
May 26, 2015, 10:20:26 AM5/26/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Am Dienstag, 26. Mai 2015 15:54:37 UTC+2 schrieb Ronny Bräunlich:
> Hi Mireilla,
>
> what I see from your server.log is:
> your process is part of "camunda-ap.war"the EJB is part of "camunda-mh.war"both WARs are deployed separately and not part of one big EARBased on this information I suppose that the CdiELResolver cannot resolve the "priorityService" because it is part of a different deployment.
> Usually the CDI BeanManager only covers one deployment (one WAR in this case) and doesn't "connect" different applications.
> Also, your EJB is only annotated with @Local and therefore camunda-ap shouldn't be able to access it.
> Could you please try to move the EJB and the process application inside one WAR and see if that works?
>
> Cheers,
> Ronny


Sorry, it's a little bit mixed up now because of different testings.

The "camunda-ap.war" contains a process called "queryProcess" and uses "StudentBean".
The "camunda-mh.war" contains a process called "camunda-mh" and uses "ProcessService".

What I'm wondering about is, that camunda-ap.war is running on a prepackaged installation fine but when I deploy it on my installation from scratch I get the previous Error.

So at all it seems I made something wrong with either the WildFly or the Camunda configuration itself.
On the other side processes like the example "Generated Forms QuickStart" are working fine .... confusing.

Ronny Bräunlich

unread,
May 28, 2015, 1:54:29 AM5/28/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Mireilla,

would it be possible for you to create a small example project for me to reproduce this behaviour on my machine?

Cheers,
Ronny

mireill...@gmail.com

unread,
May 29, 2015, 3:22:57 AM5/29/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hallo Ronny,

Please find on the following link https://www.dropbox.com/s/3h6g8xe3rg44wsk/mireilla.7z?dl=0 , the folder containing the following maven projects:
- MireillaEntities containing the entity class Developer
- MireillaDemo containing the process mireillaDemo.
- Standalone.xml file

Thank you in advance for the help

Mireilla

Ronny Bräunlich

unread,
May 29, 2015, 4:43:09 AM5/29/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hi Mireilla,

I took a look into your example and managed to get it running on the prepacked camunda 7.2 Wildfly distribution.
Some minor changes were necessary to achieve it:

Add camunda-ejb-client and camunda-engine-cdi to your Mireilla-Demo POM:
        <dependency>
         
<groupId>org.camunda.bpm.javaee</groupId>
         
<artifactId>camunda-ejb-client</artifactId>
         
<version>7.2.0</version>
       
</dependency>

       
<dependency>
         
<groupId>org.camunda.bpm</groupId>
         
<artifactId>camunda-engine-cdi</artifactId>
         
<version>7.2.0</version>
       
</dependency>
 
To mark your application as ProcessApplication and make use of autodeployment and the processes XML the dependency to camunda-ejb-client is necessary (see [1]).
To activate CDI inside your procsses you need camunda-cdi (see [2])

Finally, I had to mark your EJB as Local instead of remote

That ways I could start your example process and retrieve all "developers".

Cheers,
Ronny

[1] http://docs.camunda.org/7.2/guides/user-guide/#process-applications-the-process-application-class-the-ejbprocessapplication
[2] http://docs.camunda.org/7.2/guides/user-guide/#cdi-and-java-ee-integration-overview-maven-dependency

mireill...@gmail.com

unread,
Jun 2, 2015, 10:01:24 AM6/2/15
to camunda-...@googlegroups.com, mireill...@gmail.com
Hallo Ronny,

Thank you for your answer. Indeed, all the processes that I have developped, are working with pre-packaged camunda 7.2 Wildfly distribution.
However, I want that these processes work on the full distribution. I have followed the guide in [1].
I will try to re-configure from scratch the full distribution. It seems I made some mistakes or forget something during the conf. In case I still have the error, I will contact you back.

Cheers,


[1] http://docs.camunda.org/7.3/guides/installation-guide/jboss/
Reply all
Reply to author
Forward
0 new messages