AnsweredAssumed Answered

Problem on Activiti CDI -

Question asked by humank on Oct 21, 2014
Hello guys,
 
        I want to integrate the activiti into a web project which runs in CDI environment. (tx is under JTA)
        According to the preceding threads , i get two ways to reach my goal.
        One is to customize the ProcessEngineLookup implementation , and add the appropriate folder stucture under META-INF to make the SPI service do work.The other one is to add the activiti.cfg.xml to the classpath , and then add on the spring dependencies. I have try out the two solutions but all failed.
        Below informations are my settings, please anybody kindly to help me to figure out what's wrong with me !!

=============================================================================================
System environment

1) weblogic 12.1.2
2) activiti-cdi 5.16.4
3) Spring-context 4.0.6.RELEASE

==============================================================================================
Exception information
org.activiti.engine.ActivitiException: Could not find an implementation of the org.activiti.cdi.spi.ProcessEngineLookup service returning a non-null processEngine. Giving up.

=============================================================================================
Solution 1 - Customzie ProcessEngineLookup imlementation

1)Folder structure
META-INF
│   │       ├── beans.xml
│   │       ├── persistence.xml
│   │       └── services
│   │           └── org.activiti.cdi.spi.ProcessEngineLookup

2)the org.activiti.cdi.spi.ProcessEngineLookup file content
        [fullpackage].ProgrammaticProcessEngineConfiguration

=============================================================================================
Solution 2 - add the activiti.cfg.xml


1)activiti.cfg.xml

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

  <bean id="transactionManager" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="weblogic.transaction.TransactionManager"></property>
    <property name="resourceRef" value="true" />
  </bean>

  <bean id="processEngineConfiguration" class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
    <property name="dataSourceJndiName" value="persistence/draw-center" />
    <property name="databaseType" value="oracle" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="transactionsExternallyManaged" value="true" />
    <property name="databaseSchemaUpdate" value="true" />
  </bean>

</beans>

Outcomes