http://www.activiti.org/userguide/#cdiintegration
You may be stuck on the following issue
org.activiti.engine.ActivitiException: Could not find an implementation of the org.activiti.cdi.spi.ProcessEngineLookup service returning a non-null processEngine. Giving up. at org.activiti.cdi.impl.ActivitiExtension.lookupProcessEngine(ActivitiExtension.java:106) at org.activiti.cdi.impl.ActivitiExtension.afterDeploymentValidation(ActivitiExtension.java:68)And find many friends on the Internet with posts describing the same issue :
http://forums.activiti.org/content/activiti-cdi-exception
http://forums.activiti.org/content/issue-activiti-cdi-libraries
So we not just feeling alone; that is a good point ;)
Actually you may produce the Activiti Engine instance with a 'programatic' CDI OR a Spring activiti.cfg.xml.
This is the complete JBoss setup on BitBucket :
https://bitbucket.org/meyerd/activiti-cdi-jbossas7.1.1-setup
The activiti user guide doesn't not explain clearly the two possibilities. Here there are :
(1) Default CDI producer starts up with org.activiti.cdi.impl.LocalProcessEngineLookup
-> This is supposed to load the activiti.cfg.xml using Spring-context.
-> You need to add /META-INF/beans.xml as usual for CDI.
(2) You may overload that default CDI producer writing your own (so that you get a chance to quit Spring some day).
-> Provide a class that implements ProcessEngineLookup (see bitbucket resource).
-> Define classname in /META-INF/services/org.activiti.cdi.spi.ProcessEngineLookup
Checking with the bitbucket sample code, (2) is OK, so what is wrong with (1) ?
The cause is contained within the first lines of the complete stacktrace : a NoClassDefFoundError (!)
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable
So actually, this is just a springframework version mismatch (!) The user guides still asks for adding spring-context3.0.3.RELEASE.
BUT currently, Activiti 5.12.1 defines spring 3.1.2...
With the correct version, activiti-CDI is stating as a charm !
These are the dependencies I used :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<activiti-version>5.12.1</activiti-version> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>org.apache.openejb</groupId> | |
<artifactId>javaee-api</artifactId> | |
<version>6.0-4</version> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.activiti</groupId> | |
<artifactId>activiti-engine</artifactId> | |
<version>${activiti-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.activiti</groupId> | |
<artifactId>activiti-cdi</artifactId> | |
<version>${activiti-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-context</artifactId> | |
<version>3.1.2.RELEASE</version> | |
</dependency> | |
</dependencies> |
... Shall this post save your time ;)