cancel
Showing results for 
Search instead for 
Did you mean: 

CdiJtaProcessEngineConfiguration requests Transaction Manager before its is loaded.

theotheradam
Champ on-the-rise
Champ on-the-rise
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>
1 ACCEPTED ANSWER

Please see java - CdiJtaProcessEngineConfiguration requests Transaction Manager before its is loaded - Stack Ov... 

Yes i am sure, i verified this with a simple in code lookup, the problem is CdiJtaProcessEngineConfiguration kicks off very early in the app boot but the Transaction Manager is not register at "java:comp/TransactionManager" until later, but with a bit of research and help from Romain Manni-Bucau, it is register early enough with openejb:TransactionManager.

I am using Tomee-plus 1.7.3

View answer in original post

2 REPLIES 2

vasile_dirla
Star Contributor
Star Contributor

Are you sure you have this resources registered, "java:comp/TransactionManager" ?

can you tell us more about your environment?

Please see java - CdiJtaProcessEngineConfiguration requests Transaction Manager before its is loaded - Stack Ov... 

Yes i am sure, i verified this with a simple in code lookup, the problem is CdiJtaProcessEngineConfiguration kicks off very early in the app boot but the Transaction Manager is not register at "java:comp/TransactionManager" until later, but with a bit of research and help from Romain Manni-Bucau, it is register early enough with openejb:TransactionManager.

I am using Tomee-plus 1.7.3