AnsweredAssumed Answered

CdiJtaProcessEngineConfiguration requests Transaction Manager before its is loaded.

Question asked by theotheradam on Nov 29, 2016
Latest reply on Dec 12, 2016 by theotheradam
Hi

I am successfully able to get Activiti working with the JtaProcessEngineConfiguration and separately with the CdiStandaloneProcessEngineConfiguration.

But i am not able to get the CdiJtaProcessEngineConfiguration working, an example of my config is as follows

<blockcode>
<?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="java:comp/TransactionManager"></property>
      <property name="resourceRef" value="true" />
   </bean>

   <bean id="processEngineConfiguration" class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
      <property name="transactionManager" ref="transactionManager" />
      <property name="transactionsExternallyManaged" value="true" />

      <property name="dataSourceJndiName" value="openejb:Resource/jdbc/AppDS" />
      <property name="databaseSchemaUpdate" value="false"/>

      <property name="jobExecutorActivate" value="false"/>
      <property name="asyncExecutorEnabled" value="true"/>
      <property name="asyncExecutorActivate" value="true"/>
      <property name="history" value="audit"/>
   </bean>
</beans>
</blockcode>

With the error being
avax.naming.NameNotFoundException: Name [TransactionManager] is not bound in this Context. Unable to find [TransactionManager].


and the stack trace is as follows

<blockcode>
2016-11-29 13:47:37 ERROR ProcessEngines:174 - Exception while initializing process engine: Error creating bean with name 'processEngineConfiguration' defined in resource loaded through InputStream: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in resource loaded through InputStream: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [TransactionManager] is not bound in this Context. Unable to find [TransactionManager].
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in resource loaded through InputStream: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in resource loaded through InputStream: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [TransactionManager] is not bound in this Context. Unable to find [TransactionManager].
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary
</blockcode>

Outcomes