0 Replies Latest reply on Nov 27, 2018 1:45 AM by vijayravi

    The chosen transaction strategy requires access to the JTA TransactionManager

    vijayravi

      Details :-

      • Build and Deployed in openJDK 8
      • Spring - 3.1.1.RELEASE
      • Hibernate - 3.6.9.Final
      • Wildfly server - 8.0.0.Final


      Error :-

       

      15:25:22,969 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 53) MSC000001: Failed to start service jboss.persistenceunit."test.war#org.jbpm.persistence.jpa.test": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.war#org.jbpm.persistence.jpa.test": javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.test] Unable to build EntityManagerFactory
      at org
      .jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
      at org
      .jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
      at java
      .security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_181]
      at org
      .wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474)
      at org
      .jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
      at java
      .util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_181]
      at java
      .util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_181]
      at java
      .lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_181]
      at org
      .jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.test] Unable to build EntityManagerFactory
      at org
      .hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) [hibernate-entitymanager-3.6.9.Final.jar:3.6.9.Final]
      at org
      .hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [hibernate-entitymanager-3.6.9.Final.jar:3.6.9.Final]
      at org
      .jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
      at org
      .jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
      at org
      .jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
      ... 8 more
      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
      at org
      .hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:390) [hibernate-core-3.6.9.Final.jar:3.6.9.Final]
      at org
      .hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872) [hibernate-core-3.6.9.Final.jar:3.6.9.Final]
      at org
      .hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906) [hibernate-entitymanager-3.6.9.Final.jar:3.6.9.Final]
      ... 12 more

      15:25:22,993 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-9) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "Test-8.21.war")]) - failure description: {"JBAS014671: Failed services" => {
      "jboss.persistenceunit.\"test.war#org.jbpm.task.test\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.war#org.jbpm.task.test\": javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.task.test] Unable to build EntityManagerFactory
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.task.test] Unable to build EntityManagerFactory
      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager",
      "jboss.persistenceunit.\"test.war#org.jbpm.persistence.jpa.test\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.war#org.jbpm.persistence.jpa.test\": javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.test] Unable to build EntityManagerFactory
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.test] Unable to build EntityManagerFactory
      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager"
      }}
      15:25:22,995 ERROR [org.jboss.as.server] (XNIO-1 task-9) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message:
      {"JBAS014671: Failed services" => {
      "jboss.persistenceunit.\"test.war#org.jbpm.task.test\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.war#org.jbpm.task.test\": javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.task.test] Unable to build EntityManagerFactory
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.task.test] Unable to build EntityManagerFactory
      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager",
      "jboss.persistenceunit.\"test.war#org.jbpm.persistence.jpa.test\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.war#org.jbpm.persistence.jpa.test\": javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.test] Unable to build EntityManagerFactory
      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.persistence.jpa.test] Unable to build EntityManagerFactory
      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager"
      }}

       

      Persistence.xml :-

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <persistence version="1.0"
        xsi
      :schemaLocation="http://java.sun.com/xml/ns/persistence
        http
      ://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
        http
      ://java.sun.com/xml/ns/persistence/orm
        http
      ://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
        xmlns
      :orm="http://java.sun.com/xml/ns/persistence/orm"
        xmlns
      :xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns
      ="http://java.sun.com/xml/ns/persistence">
      <persistence-unit name="org.jbpm.persistence.jpa.test" transaction-type="JTA">
        
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
        
      <jta-data-source>java:jboss/datasources/MSQLDS</jta-data-source>
        
      <mapping-file>META-INF/JBPMorm.xml</mapping-file>
        
      <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>
        
      <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
        
      <class>org.drools.persistence.info.SessionInfo</class>
        
      <class>org.drools.persistence.info.WorkItemInfo</class>  
      </persistence-unit>
      <persistence-unit name="org.jbpm.task.test">
        
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
        
      <mapping-file>META-INF/Taskorm.xml</mapping-file>
        
      <class>org.jbpm.task.Attachment</class>
        
      <class>org.jbpm.task.Content</class>
        
      <class>org.jbpm.task.BooleanExpression</class>
        
      <class>org.jbpm.task.Comment</class>
        
      <class>org.jbpm.task.Deadline</class>
        
      <class>org.jbpm.task.Comment</class>
        
      <class>org.jbpm.task.Deadline</class>
        
      <class>org.jbpm.task.Delegation</class>
        
      <class>org.jbpm.task.Escalation</class>
        
      <class>org.jbpm.task.Group</class>
        
      <class>org.jbpm.task.I18NText</class>
        
      <class>org.jbpm.task.Notification</class>
        
      <class>org.jbpm.task.EmailNotification</class>
        
      <class>org.jbpm.task.EmailNotificationHeader</class>
        
      <class>org.jbpm.task.PeopleAssignments</class>
        
      <class>org.jbpm.task.Reassignment</class>
        
      <class>org.jbpm.task.Status</class>
        
      <class>org.jbpm.task.Task</class>
        
      <class>org.jbpm.task.TaskData</class>
        
      <class>org.jbpm.task.SubTasksStrategy</class>
        
      <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>
        
      <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>
        
      <class>org.jbpm.task.User</class>  
      </persistence-unit>
      </persistence>

       

       

      Applicationcontext.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"
        xmlns
      :aop="http://www.springframework.org/schema/aop"
        xmlns
      :context="http://www.springframework.org/schema/context"
        xmlns
      :tx="http://www.springframework.org/schema/tx"
        xmlns
      :p="http://www.springframework.org/schema/p"
        xmlns
      :util="http://www.springframework.org/schema/util"

        xsi
      :schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http
      ://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
        http
      ://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http
      ://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
        http
      ://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
      "> 
      <util:properties id="messages" location="classpath:messages.properties"/>
      <util:properties id="fmsproperties" location="classpath:fms.properties"/>

      <aop:aspectj-autoproxy proxy-target-class="true"/>
      <bean id="taskService" class="com.test.workflow.services.TaskServiceImpl"/>
      <bean id="taskManagement" class="com.test.workflow.engine.TaskManagementImpl"/>
      <bean id="humanTaskHandler" class="com.test.workflow.engine.LocalHTWorkItemHandler"/>
      <bean id="taskAspect" class="com.test.aspects.TaskNotificationAspect"/>
      <bean id="userAspect" class="com.test.aspects.UserNotificationAspect"/>
      <bean id="customerStatusAspect" class="com.test.aspects.CustomerStatusAspect"/>
      <bean id="processAspect" class="com.test.aspects.ProcessNotificationAspect"/>
      <bean id="configMap" class="java.util.HashMap" />

      <context:component-scan base-package="com.test" use-default-filters="false">
        
      <context:include-filter expression="org.springframework.stereotype.Service" type="annotation" />
        
      <context:include-filter expression="org.springframework.stereotype.Component" type="annotation" />
        
      <context:include-filter expression="org.springframework.stereotype.Repository" type="annotation" />
      </context:component-scan>

      <util:properties id="system">
        
      <prop key="mqhost">${mq.host}</prop>
        
      <prop key="mqusername">${mq.username}</prop>
        
      <prop key="mqpassword">${mq.password}</prop>
        
      <prop key="mqvirtualhost">${mq.virtualhost}</prop>
        
      <prop key="mqexchange">${mq.exchange}</prop>
        
      <prop key="mqbaseroute">${mq.baseroute}</prop>
        
      <prop key="mqqueue">${mq.queue}</prop>
        
      <prop key="materialrevisesdefaultvalue">${materialRevises.defaultValue}</prop>
        
      <prop key="orderrevisesdefaultvalue">${orderRevises.defaultValue}</prop>
        
      <prop key="articleAutoCompleteProcess">${articleAutoCompleteProcess}</prop>
        
      <prop key="issueAutoCompleteProcess">${issueAutoCompleteProcess}</prop>
        

      </util:properties>

      <bean id="dataSource"
        
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        p
      :driverClassName="${jdbc.driver}"
        p
      :url="${jdbc.url}"
        p
      :username="${jdbc.username}"
        p
      :password="${jdbc.password}" />


      <bean id="flyway" class="com.googlecode.flyway.core.Flyway" init-method="migrate">
        
      <property name="dataSource" ref="dataSource"/>
      </bean>

      <!-- Hibernate SessionFactory -->
      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        
      <property name="dataSource">
        
      <ref local="dataSource"/>
        
      </property>
        
      <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
        
      <property name="packagesToScan">
        
      <list>
        
      <value>com.test.filemanagement.domain</value>
        
      <value>com.test.usermanagement.domain</value>
        
      <value>com.test.workflow.domain</value>
        
      </list>
        
      </property>
        
      <property name="hibernateProperties">
        
      <props>
        
      <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
        
      <prop key="hibernate.hbm2ddl.auto">validate</prop>
        
      <!-- <prop key="hibernate.show_sql">${jdbc.hibernate.show_sql}   </prop> -->

        
      <!--<prop key="hibernate.show_sql">true</prop>-->

        
      <prop key="hibernate.show_sql">false</prop>

        
      </props>
        
      </property>
        
      <property name="eventListeners">
        
      <map>
        
      <entry key="pre-update">
        
      <bean class="com.test.hibernate.PreUpdateDateListener" />
        
      </entry>
        
      <entry key="pre-insert">
        
      <bean class="com.test.hibernate.PreInsertDateListener" />
        
      </entry>
        
      </map>
        
      </property>
      </bean>

      <!-- Hibernate Template -->
      <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
        
      <property name="sessionFactory">
        
      <ref local="sessionFactory"/>
        
      </property>
        
      <property name="flushModeName" value="FLUSH_COMMIT" />
      </bean>

      <bean id="validatorFactory" class="javax.validation.Validation"
        factory
      -method="buildDefaultValidatorFactory" />

      <bean id="validator" factory-bean="validatorFactory"
        factory
      -method="getValidator" />

      <bean id="inflector" class="org.modeshape.common.text.Inflector"
        factory
      -method="getInstance" />


      <beans profile="test">
      <context:property-placeholder ignore-resource-not-found="true" location="classpath:pack.test.properties,file:///test/data/prop/pack.test.properties"/>
      <bean id="jbpmEmf" class="javax.persistence.Persistence" factory-method="createEntityManagerFactory">
        
      <constructor-arg>
        
      <value>org.jbpm.persistence.jpa.test</value>
        
      </constructor-arg>
        
      <constructor-arg>
        
      <map>
        
      <entry key="hibernate.max_fetch_depth" value="3"> </entry>
        
      <entry key="hibernate.hbm2ddl.auto" value="validate"> </entry>
        
      <entry key="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"> </entry>
        
      <entry key="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"> </entry>
        
      <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"> </entry>
        
      <entry key="jboss.as.jpa.providerModule" value="application"> </entry>
        
      </map>
        
      </constructor-arg>
      </bean>
      <bean id="taskEmf" class="javax.persistence.Persistence" factory-method="createEntityManagerFactory">
        
      <constructor-arg>
        
      <value>org.jbpm.task.test</value>
        
      </constructor-arg>
        
      <constructor-arg> 
        
      <map> 
        
      <entry key="hibernate.max_fetch_depth" value="3"> </entry>
        
      <entry key="hibernate.hbm2ddl.auto" value="validate"></entry>
        
      <entry key="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"></entry>
        
      <entry key="hibernate.connection.url"  value="${hibernate.connection.url}"></entry> 
        
      <entry key="hibernate.connection.username" value="${hibernate.connection.username}"></entry> 
        
      <entry key="hibernate.connection.password" value="${hibernate.connection.password}"></entry>
        
      <entry key="hibernate.show_sql" value="true"></entry>
        
      <entry key="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"></entry>
        
      <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"></entry>
        
      <entry key="hibernate.connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider"></entry>
        
      <entry key="hibernate.c3p0.max_size" value="200"></entry>
        
      <entry key="hibernate.c3p0.min_size" value="10"></entry>
        
      <entry key="hibernate.c3p0.acquire_increment" value="100"></entry>
        
      <entry key="hibernate.c3p0.idle_test_period" value="120"></entry>
        
      <entry key="hibernate.c3p0.max_statements" value="2000"></entry>
        
      <entry key="hibernate.c3p0.timeout" value="60"></entry>
        
      <entry key="hibernate.c3p0.validate" value="true"></entry>
        
      <entry key="hibernate.c3p0.unreturnedConnectionTimeout" value="600"></entry>
        
      <entry key="hibernate.c3p0.debugUnreturnedConnectionStackTraces" value="true"></entry>
        
      <entry key="jboss.as.jpa.providerModule" value="application"> </entry> 
        
      </map>
        
      </constructor-arg>
      </bean>
      <bean id="jbpmTransactionManager" class="com.test.workflow.engine.BeanFactory" factory-method="createJBossTransactionManager">
      </bean>
      <bean id="hornetQ" class="com.test.workflow.engine.BeanFactory" factory-method="getAPIQueueName"/>
      <tx:annotation-driven transaction-manager="txManager" proxy-target-class="true" />
      <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        
      <property name="sessionFactory" ref="sessionFactory" />
      </bean>

       

       

      Also, if I move the persistence unit property in applicationContext.xml to persistence.xml. It works fine.

      I would like to resolve this error. Any suggestions ?