9 Replies Latest reply on Sep 21, 2006 6:18 AM by vel pandian

    How to run Distributed Transaction?

    vel pandian Newbie

      I want to run distributed transaction.
      when i run this code in 2 different process( in 2 different dos prompt ) its getting commited where as i should get exception.
      Am i wrong some where?
      plzz help me...

      System.setProperty("com.arjuna.ats.jta.jtaTMImplementation","com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple");
       System.setProperty("com.arjuna.ats.jta.jtaUTImplementation","com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple");
      
       ORB orb = ORB.getInstance( "JacORB" );
       orb.initORB( arg, null );
       TreeCache tree = new TreeCache();
       PropertyConfigurator config = new PropertyConfigurator(); // configure tree cache. Needs to be in the classpath
       config.configure(tree, "replAsync-service.xml");
       tree.setClusterName( "cluster1" );
       tree.startService(); // kick start tree cache
      
       Person p = (Person)tree.get("/ds","ben");
       UserTransaction tx = com.arjuna.ats.jta.UserTransaction.userTransaction();
       tx.begin();
       System.out.println( "tran beign" );
       p.setAge( 40 );
       tree.put("/ds", "ben", p);
       System.out.println( "press enter to commit tran" );
       System.in.read();
       tx.commit();


        • 1. Re: How to run Distributed Transaction?
          Jonathan Halliday Master

          Hello velpandian

          I don't see how you are making the cache transaction aware. Are you populating the JNDI with the transactionmanager or using some other approach?

          • 2. Re: How to run Distributed Transaction?
            vel pandian Newbie

            Thnx for the reply.
            U where correct i was not making cache transaction aware of The transaction manager.
            It would be a gr8 help if u can solve this problem.
            I had added the follwoing code in cache and now cache transaction knows about TransactionManager

            <attribute name="TransactionManagerLookupClass">MyJBossTransactionManagerLookup</attribute>


            But Now i am getting the following exception.

            Exception in thread "main" java.lang.RuntimeException: javax.transaction.SystemException
             at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4810)
             at org.jboss.cache.TreeCache.get(TreeCache.java:3040)
             at org.jboss.cache.TreeCache.get(TreeCache.java:3021)
             at org.jboss.cache.loader.CacheLoaderManager.preload(CacheLoaderManager.java:246)
             at org.jboss.cache.loader.CacheLoaderManager.preloadCache(CacheLoaderManager.java:226)
             at org.jboss.cache.TreeCache.startService(TreeCache.java:1340)
             at TestGet.main(TestGet.java:32)
            Caused by: javax.transaction.SystemException
             at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.registerSynchronization(TransactionImple.java:468)
             at org.jboss.cache.interceptors.OrderedSynchronizationHandler.getInstance(OrderedSynchronizationHandler.java:46)
             at org.jboss.cache.interceptors.TxInterceptor.registerHandler(TxInterceptor.java:849)
             at org.jboss.cache.interceptors.TxInterceptor.registerTransaction(TxInterceptor.java:826)
             at org.jboss.cache.interceptors.TxInterceptor.attachGlobalTransaction(TxInterceptor.java:368)
             at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:324)
             at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:139)
             at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
             at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:133)
             at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4804)


            • 3. Re: How to run Distributed Transaction?
              Jonathan Halliday Master

              That trace is indicative of misconfiguration in your environment. Are the JacORB properties correct? Is the recovery manager running? Have you run the examples that come with the transaction service to ensure it is installed and configured correctly?

              Jonathan.

              • 4. Re: How to run Distributed Transaction?
                vel pandian Newbie

                I had started start-transaction-service.bat & start-recovery-manager.bat

                This is the exception i am getting when running the client( java com.arjuna.demo.jts.explicitremotebank.BankClient )

                on client i am trying to create a account.

                Is it possible to point out wht property i am missing?

                Error on client Side

                [19-09-2006 19:03:04:125] jacorb.poa.controlle:ERROR: rid: 8 opname: register_resource invocation: throwable was thrown (java.lang.IncompatibleClassChangeError)
                java.lang.IncompatibleClassChangeError
                 at com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.RecoverIOR$RecoverableParsedIOR.<init>(RecoverIOR.java:49)
                 at com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.RecoverIOR$RecoverableParsedIOR.<init>(RecoverIOR.java:45)
                 at com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.RecoverIOR.newObjectKey(RecoverIOR.java:112)
                 at com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCManager.makeRC(JacOrbRCManager.java:122)
                 at com.arjuna.ats.internal.jts.recovery.recoverycoordinators.GenericRecoveryCreator.create(GenericRecoveryCreator.java:142)
                 at com.arjuna.ats.internal.jts.recovery.RecoveryCreator.createRecoveryCoordinator(RecoveryCreator.java:111)
                 at com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple.register_resource(ArjunaTransactionImple.java:867)
                 at com.arjuna.ArjunaOTS.ArjunaTransactionPOATie.register_resource(ArjunaTransactionPOATie.java:64)
                 at com.arjuna.ArjunaOTS.ArjunaTransactionPOA._invoke(ArjunaTransactionPOA.java:76)
                 at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:299)
                 at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:593)
                 at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:735)
                [19-09-2006 19:03:04:953] jacorb.orb.iiop:INFO: Closed server-side transport to 192.168.1.113:15686
                [19-09-2006 19:03:04:953] jacorb.orb.iiop:INFO: Client-side TCP transport to 192.168.1.113:15672 closed.
                ERROR - org.omg.CORBA.COMM_FAILURE: vmcid: 0x0 minor code: 0 completed: Maybe
                


                Error on server Side
                [19-09-2006 19:03:04:062] jacorb.orb.giop:INFO: ClientConnectionManager: found ClientGIOPConnection to 192.168.1.113:15677 (1b09468)
                CosTransactions Error: Could not get_current() SystemException: org.omg.CORBA.UNKNOWN: Server-side Exception: java.lang.IncompatibleClassChangeError vmcid: 0x0 minor code: 0 completed: No
                org.omg.CORBA.UNKNOWN: Server-side Exception: java.lang.IncompatibleClassChangeError vmcid: 0x0 minor code: 0 completed: No
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                 at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
                 at org.jacorb.orb.SystemExceptionHelper.read(SystemExceptionHelper.java:173)
                 at org.jacorb.orb.ReplyReceiver.getReply(ReplyReceiver.java:326)
                 at org.jacorb.orb.Delegate.invoke_internal(Delegate.java:963)
                 at org.jacorb.orb.Delegate.invoke(Delegate.java:857)
                 at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
                 at org.omg.CosTransactions._CoordinatorStub.register_resource(_CoordinatorStub.java:760)
                 at com.arjuna.demo.jts.explicitremotebank.AccountImpl.getResource(Unknown Source)
                 at com.arjuna.demo.jts.explicitremotebank.AccountImpl.credit(Unknown Source)
                 at com.arjuna.demo.jts.explicitremotebank.AccountPOA._invoke(Unknown Source)
                 at org.jacorb.poa.RequestProcessor.invokeOperation(RequestProcessor.java:299)
                 at org.jacorb.poa.RequestProcessor.process(RequestProcessor.java:593)
                 at org.jacorb.poa.RequestProcessor.run(RequestProcessor.java:735)
                



                • 5. Re: How to run Distributed Transaction?
                  Kevin Conner Master

                  You will have this error if you are using the wrong jacorb library. Have you used the one which comes with the TS download?

                  Kev

                  • 6. Re: How to run Distributed Transaction?
                    vel pandian Newbie

                    I am getting this msg on the transaction-service command prompt when i run my example...
                    Any Idea where i can be wrong.

                    [19-09-2006 19:26:36:828] jacorb.poa.controlle:INFO: rid: 148 opname: register_synchronization invocation: system exception was thrown (org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed:
                     No)


                    Regards,
                    Velpandian

                    • 7. Re: How to run Distributed Transaction?
                      Kevin Conner Master

                      You appear to have a misconfiguration in your environment. The best thing to do is to start from a clean installation and go through the examples that come with the download.

                      You can then retry your application once you have these running.

                      Kev

                      • 8. Re: How to run Distributed Transaction?
                        vel pandian Newbie

                        Thx My example code is running fine now.
                        But still i have problem running my sample code using jboss cache.
                        Can any one tell me wht setting i might be missing.

                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        2006-09-20 12:15:04,593 [main] WARN com.arjuna.ats.jta.logging.loggerI18N - [com.arjuna.ats.internal.jta.transaction.jts.syncproblem] [com.arjuna.ats.internal.jta.transaction.jts.syncproble] - cleanup synchronization failed to register:
                        java.lang.NullPointerException
                         at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.<init>(TransactionImple.java:134)
                         at com.arjuna.ats.internal.jta.transaction.jts.BaseTransaction.begin(BaseTransaction.java:128)
                         at org.jboss.cache.interceptors.TxInterceptor.createLocalTx(TxInterceptor.java:889)
                         at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:320)
                         at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:139)
                         at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
                         at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:133)
                         at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4804)
                         at org.jboss.cache.TreeCache.get(TreeCache.java:3040)
                         at org.jboss.cache.TreeCache.get(TreeCache.java:3021)
                         at org.jboss.cache.loader.CacheLoaderManager.preload(CacheLoaderManager.java:246)
                         at org.jboss.cache.loader.CacheLoaderManager.preloadCache(CacheLoaderManager.java:226)
                         at org.jboss.cache.TreeCache.startService(TreeCache.java:1340)
                         at TestGet.main(TestGet.java:29)
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        2006-09-20 12:15:04,875 [main] WARN com.arjuna.orbportability.logging.loggerI18N - [com.arjuna.orbportability.OA.invalidpoa] objectIsReady - invalid POA: rootPOA
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        [jacorb.orb.giop] INFO : ClientConnectionManager: found conn to target 192.168.1.113:1536
                        Exception in thread "main" java.lang.RuntimeException: javax.transaction.SystemException
                         at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4810)
                         at org.jboss.cache.TreeCache.get(TreeCache.java:3040)
                         at org.jboss.cache.TreeCache.get(TreeCache.java:3021)
                         at org.jboss.cache.loader.CacheLoaderManager.preload(CacheLoaderManager.java:246)
                         at org.jboss.cache.loader.CacheLoaderManager.preloadCache(CacheLoaderManager.java:226)
                         at org.jboss.cache.TreeCache.startService(TreeCache.java:1340)
                         at TestGet.main(TestGet.java:29)
                        Caused by: javax.transaction.SystemException
                         at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.registerSynchronization(TransactionImple.java:468)
                         at org.jboss.cache.interceptors.OrderedSynchronizationHandler.getInstance(OrderedSynchronizationHandler.java:46)
                         at org.jboss.cache.interceptors.TxInterceptor.registerHandler(TxInterceptor.java:849)
                         at org.jboss.cache.interceptors.TxInterceptor.registerTransaction(TxInterceptor.java:826)
                         at org.jboss.cache.interceptors.TxInterceptor.attachGlobalTransaction(TxInterceptor.java:368)
                         at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:324)
                         at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:139)
                         at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
                         at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:133)
                         at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4804)
                         ... 6 more
                        
                        


                        • 9. Re: How to run Distributed Transaction?
                          vel pandian Newbie

                          Hi
                          I started the TransactionService & RecoveryManagerService and when i run this basic code
                          it gives me error where as the demo Trail_map is running fine is there some thing else i need to do to run this sample code.

                           ORB orb = ORB.getInstance( "JacORB" );
                           orb.initORB( arg, null );
                           OA oa = OA.getRootOA( orb );
                           oa.init();
                           ORBManager.setORB(orb);
                           ORBManager.setPOA(oa);
                          
                           javax.transaction.TransactionManager transactionManager =
                           com.arjuna.ats.jta.TransactionManager.transactionManager();
                          
                           transactionManager.begin();
                           transactionManager.commit();
                          

                          I getting the following exception.
                          2006-09-21 14:25:56,218 [main] WARN com.arjuna.ats.jta.logging.loggerI18N - [com.arjuna.ats.internal.jta.tran
                          saction.jts.syncproblem] [com.arjuna.ats.internal.jta.transaction.jts.syncproble] - cleanup synchronization fa
                          iled to register:
                          java.lang.NullPointerException
                           at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.<init>(TransactionImple.java:134)
                           at com.arjuna.ats.internal.jta.transaction.jts.BaseTransaction.begin(BaseTransaction.java:128)
                           at TestGet.main(TestGet.java:30)