7 Replies Latest reply on Jun 1, 2012 10:16 AM by merjabloun

    How to fix: "The chosen transaction strategy requires access to the JTA TransactionManager" issue?

    victor ma Newbie

      hi, all.

      i am stuck on this problem for days:

      org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager

          at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:361)

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)

          at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)

          at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:343)

          at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:323)

          at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:125)

          at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:336)

          at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptors(AbstractPersistenceUnitRegistry.java:111)

          at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:58)

          at weblogic.servlet.internal.WebAppModule.setupPersistenceUnitRegistry(WebAppModule.java:1661)

          at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:364)

          at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)

          at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)

          at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)

          at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)

          at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)

          at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)

          at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:609)

          at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)

          at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:185)

          at weblogic.application.internal.SingleModuleDeployment.prepare(SingleModuleDeployment.java:40)

          at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)

          at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)

          at weblogic.deploy.internal.targetserver.AppDeployment.prepare(AppDeployment.java:141)

          at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:39)

          at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:187)

          at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)

          at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)

          at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)

          at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)

          at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)

          at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)

          at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)

          at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)

          at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

       

      i use weblogic 10 and sql server 2005.

      i config the persistence.xml like this:

       

        <persistence-unit name="org.jbpm.persistence.jpa_df" transaction-type="JTA">

          <jta-data-source>java:jdbc/testDS1</jta-data-source>       

          <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

          <class>org.drools.persistence.info.SessionInfo</class>

          <class>org.drools.persistence.info.WorkItemInfo</class>

          <properties>

              <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>

            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>

            <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />

          </properties>       

        </persistence-unit>

       

      and i config a xa datasource in weblogic:

       

      <?xml version='1.0' encoding='UTF-8'?>

      <jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/jdbc-data-source http://xmlns.oracle.com/weblogic/jdbc-data-source/1.0/jdbc-data-source.xsd">

        <name>TestDS</name>

        <jdbc-driver-params>

          <url>jdbc:sqlserver://localhost:1433</url>

          <driver-name>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</driver-name>

          <properties>

            <property>

              <name>user</name>

              <value>sa</value>

            </property>

            <property>

              <name>databaseName</name>

              <value>JBPM</value>

            </property>

          </properties>

          <password-encrypted>{AES}UbBXRaasDQfeERYL0cclmgRUdrDZ+Ma0L7VTY9dTTR8=</password-encrypted>

        </jdbc-driver-params>

        <jdbc-connection-pool-params>

          <test-table-name>task</test-table-name>

        </jdbc-connection-pool-params>

        <jdbc-data-source-params>

          <jndi-name>jdbc/testDS1</jndi-name>

          <global-transactions-protocol>TwoPhaseCommit</global-transactions-protocol>

        </jdbc-data-source-params>

      </jdbc-data-source>

       

      anyone has any idea about this issue? thanks!

        • 1. Re: How to fix: "The chosen transaction strategy requires access to the JTA TransactionManager" issue?
          James Williams Newbie

          Here is my persistence.xml content.

           

          <persistence-unit name="org.jbpm.persistence.jpa" >

                              <provider>org.hibernate.ejb.HibernatePersistence</provider>

                              <jta-data-source>jdbc/processInstanceDS</jta-data-source>

                              <class>org.drools.persistence.info.SessionInfo</class>

                              <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

                              <class>org.drools.persistence.info.WorkItemInfo</class>

                              <class>org.jbpm.process.audit.ProcessInstanceLog</class>

                              <class>org.jbpm.process.audit.NodeInstanceLog</class>

                              <class>org.jbpm.process.audit.VariableInstanceLog</class>

                              <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>

           

           

                              <properties>

                                        <property name="hibernate.dialect" value="${hibernate.dialect}" />

                                        <property name="hibernate.max_fetch_depth" value="3" />

                                        <property name="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />

                                        <property name="hibernate.show_sql" value="${hibernate.show_sql}" />

                                        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />

                              </properties>

                    </persistence-unit>

           

          Note the <provider>org.hibernate.ejb.HibernatePersistence</provider>

          • 3. Re: How to fix: "The chosen transaction strategy requires access to the JTA TransactionManager" issue?
            Demian Calcaprina Master

            You provide the transaction manager when creating the session. Something like:

            Environment env = KnowledgeBaseFactory.newEnvironment();

                                env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

                                env.set(EnvironmentName.TRANSACTION_MANAGER,

                                                    TransactionManagerServices.getTransactionManager());

                                final StatefulKnowledgeSession session = JPAKnowledgeService

                                                    .newStatefulKnowledgeSession(kbase, null, env);

             

            Regards,

             

            Demian

            • 4. Re: How to fix: "The chosen transaction strategy requires access to the JTA TransactionManager" issue?
              sharyak Newbie

              I am getting this error during deployment

              <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">

              <provider>org.hibernate.ejb.HibernatePersistence</provider>

                  <jta-data-source>jdbc/niaamDS</jta-data-source>      

                   <mapping-file>META-INF/JBPMorm.xml</mapping-file>

                  <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

                  <class>org.drools.persistence.info.SessionInfo</class>

                  <class>org.drools.persistence.info.WorkItemInfo</class>

                 

                    <properties>

                    <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />

                    <property name="hibernate.max_fetch_depth" value="3"/>

                    <property name="hibernate.hbm2ddl.auto" value="create" />

                    <property name="hibernate.show_sql" value="true" />   

                    <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />

                  </properties> 

               

                </persistence-unit>

               

              </persistence>

              • 6. Re: How to fix: "The chosen transaction strategy requires access to the JTA TransactionManager" issue?
                Demian Calcaprina Master

                How do you define your datasource?

                 

                Would it be possible that this:

                org.hibernate.transaction.WeblogicTransactionManagerLookup

                Is not resolving your datasource? I use Bitronix TM and it works fine.

                • 7. Re: How to fix: "The chosen transaction strategy requires access to the JTA TransactionManager" issue?
                  merjabloun Newbie

                  It can be fixed by adding this property to the persistence.xml file :

                   

                  <!--  working with jboss -->

                   

                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>

                   

                  otherWhise you can use this

                   

                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.TransactionManagerLookup"/>

                   

                  Hope it helps you tofix it.