3 Replies Latest reply on Jan 24, 2012 3:19 AM by zvrablik79

    Setting up transaction manager outside of JBoss AS

    jaikiran

      I'm trying to use JBoss Transactions from a (kind of) standalone client. My goal is to setup a functional transaction manager and the transaction synchronization registry on a remote client side (which ultimately communicates with a AS7 server). Right now, my initial attempts at doing this involve just a couple of lines of code (which I guess aren't sufficient):

       

       

      private static void instantiateTxManagement() {
          txManager = jtaPropertyManager.getJTAEnvironmentBean().getTransactionManager();
          txSyncRegistry = jtaPropertyManager.getJTAEnvironmentBean().getTransactionSynchronizationRegistry();
      

       

       

      A subsequent txManager.begin() runs into problems:

       

      com.arjuna.ats.arjuna.exceptions.FatalError
          at com.arjuna.ats.internal.jts.ORBManager.getPOA(ORBManager.java:87)
          at com.arjuna.ats.internal.jts.OTSImpleManager.<clinit>(OTSImpleManager.java:299)
          at com.arjuna.ats.jts.OTSManager.get_current(OTSManager.java:69)
          at com.arjuna.ats.internal.jta.transaction.jts.BaseTransaction.checkTransactionState(BaseTransaction.java:255)
          at com.arjuna.ats.internal.jta.transaction.jts.BaseTransaction.begin(BaseTransaction.java:74)
      

       

      So is there some doc/code/test/anything else that I can use as a reference to setup a functional transaction manager in a environment outside of JBoss AS?

        • 1. Re: Setting up transaction manager outside of JBoss AS
          jhalliday

          Looks like you are trying to run JBossTS in JTS mode, which requires an ORB. Install one and you should be good to go.

          • 2. Re: Setting up transaction manager outside of JBoss AS
            jaikiran

            Jonathan Halliday wrote:

             

            Looks like you are trying to run JBossTS in JTS mode, which requires an ORB.

            Thanks for that hint. It appears that due to a property being set (somewhere within the bootup process), the JTS mode was triggered. I added an explicit property to use the JTA mode and the above code works just fine now. Thanks!

             

            For those curious, here's what I did:

             

            // These system properties are required or else we end up picking up JTS transaction manager,
            // which is not what we want
            System.setProperty(JTAEnvironmentBean.class.getSimpleName() + "." + "transactionManagerClassName", TransactionManagerImple.class.getName());
            System.setProperty(JTAEnvironmentBean.class.getSimpleName() + "." + "transactionSynchronizationRegistryClassName", TransactionSynchronizationRegistryImple.class.getName());
            txManager = jtaPropertyManager.getJTAEnvironmentBean().getTransactionManager();
            txSyncRegistry = jtaPropertyManager.getJTAEnvironmentBean().getTransactionSynchronizationRegistry();
            
            • 3. Re: Setting up transaction manager outside of JBoss AS
              zvrablik79

              you could modify the xml configuration file to use JTA instead of JTS. Default xml file is part of the jar file. Copy the xml file and rename it to jbossts-properties.xml and change JTAEnvironmentBean settings.

               

              <entry key="JTAEnvironmentBean.transactionManagerClassName">com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple</entry>

               

              <entry key="JTAEnvironmentBean.userTransactionClassName">com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple</entry>

               

              I had to remove this entry too

              <!--    <entry key="RecoveryEnvironmentBean.recoveryActivatorClassNames">com.arjuna.ats.internal.jts.orbspecific.recovery.RecoveryEnablement</entry> -->

               

              Regards,
              Zdenek