2 Replies Latest reply on Dec 15, 2011 5:48 AM by Nicholas Hemley

    JBoss AS 7 UserTransaction

    Fabiano Frizzo Newbie

      I'm having problems Retrieve the UserTransaction. I'm using Spring 3.

      View Log

       

      11:09:56,254 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (MSC service thread 1-3) Using JTA UserTransaction: Transaction: unknown

      11:09:56,254 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (MSC service thread 1-3) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@4922c082

      11:09:56,255 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (MSC service thread 1-3) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@19db0a1d

       

       

      Declaration in applicatonContext.xml

       

      <bean id="transactionManager"
             class="org.springframework.transaction.jta.JtaTransactionManager">
             <property name="transactionManagerName" value="java:jboss/TransactionManager" />
             <property name="userTransactionName" value="java:module/UserTransaction" />
      </bean>
      


       

      In other versions of JBoss so I used

       

              <bean id="transactionManager"
                          class="org.springframework.transaction.jta.JtaTransactionManager">
                          <property name="transactionManagerName" value="java:TransactionManager" />
                          <property name="userTransactionName" value="UserTransaction" />
                </bean>
      


      Am I doing something wrong?

       

      Thanks



        • 1. Re: JBoss AS 7 UserTransaction
          Fabiano Frizzo Newbie

          I do not know if you already had the solution somewhere but I ended up getting arrrumar here.

          Actually I had not stopped to pay attention.

           

          Problem is not in the Spring or JBoss, but in Hibernate 3

           

          The solution was simple created a TransactionManagerLookup passing the correct values

           

          public class JBoss7TransactionManagerLookup extends JNDITransactionManagerLookup {
          
                     @Override
                    public String getUserTransactionName() {
                           return "java:module/UserTransaction";
                    }
          
                     @Override
                    protected String getName() {
                           return "java:jboss/TransactionManager"; 
                    }
          
          }
          


          Thanks

          • 2. Re: JBoss AS 7 UserTransaction
            Nicholas Hemley Newbie

            FYI JBoss 7.0.2 uses java:jboss/UserTransaction and not java:module/UserTransaction

             

            E.g.


            {code}

             

            public class JBossAS7TransactionManagerLookup extends JNDITransactionManagerLookup {

             

             

                      @Override

                      protected String getName() {

                                return "java:jboss/TransactionManager";

                      }

             

             

                      @Override

                      public String getUserTransactionName() {

                                return "java:jboss/UserTransaction";

                      }

            }

             

            {code}