3 Replies Latest reply on Jul 28, 2010 2:49 AM by Preben Asmussen

    XA Transactions

    Preben Asmussen Newbie

      Hi

       

      I'm doing a small POC on Servicemix, but got stuck on the question about XA transactions and 2PC.

       

      The use case is:

      1. Pull n records from interface table in database 1.

      2. For each record call stored proc. on database 2.

      3. When finished - delete all read records from table in database 1

       

      This will be implemented in a Camel route and has to be under XA control using Oracle DB.

       

      Is this scenario supported using SMX4 ? Eg. is there a build in transaction-manager that supports XA transactions.

       

      Any examples in Camel that deals with XA transactions ? This will really help.

       

      Thanks

      Preben

        • 1. Re: XA Transactions
          Claus Ibsen Master

          There is a transactions guide at the FUSE MR documentation.

           

          Also the Camel in Action book chapter 9 covers how to use XA transactions with Camel. http://fusesource.com/fuse/apache-books/

          • 2. Re: XA Transactions
            Preben Asmussen Newbie

            Hi Claus

             

            I have been looking at both. Chapter 9 uses Atomikos, but to my knowledge smx4 comes with jencks and Geronimo transaction manager.

             

            I was kind of hoping that I could use smx4 features out of the box to prove XA.

             

            A working example would be helpfull.

             

            Preben

            • 3. Re: XA Transactions
              Preben Asmussen Newbie

              I'm still trying to get xa to work i smx4 using Jencks 2.2 support. Seems that there is a missing Tranql connector bundle. I'm getting an java.lang.ClassNotFoundException: org.tranql.connector.jdbc.AbstractXADataSourceMCF

               

              Anybody had any experience with Tranql and where to get a osgi bundle that runs on smx4 ?

               

              I have attached the camel route.

               

                                                • stacktrace **********************

              Error creating bean with name 'camelContext': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class for bean with name 'appsJdbcManagedConnectionFactory' defined in URL bundleentry://209.fwk902782/META-INF/spring/camel-context.xml: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org.jencks.tranql.DataSourceMCF not found from bundle

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

                   at java.security.AccessController.doPrivileged(Native Method)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

                   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

                   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

                   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)

                   at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)

                   at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:701)

                   at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1500(AbstractDelegatedExecutionApplicationContext.java:69)

                   at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:351)

                   at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                   at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)

                   at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)

                   at java.lang.Thread.run(Thread.java:619)

              Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class for bean with name 'appsJdbcManagedConnectionFactory' defined in URL bundleentry://209.fwk902782/META-INF/spring/camel-context.xml: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org.jencks.tranql.DataSourceMCF not found from bundle

                   at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1144)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)

                   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)

                   at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:937)

                   at org.apache.camel.spring.CamelContextFactoryBean.getBeanForType(CamelContextFactoryBean.java:570)

                   at org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:192)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)

                   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)

                   ... 18 more

              Caused by: java.lang.NoClassDefFoundError: org.jencks.tranql.DataSourceMCF not found from bundle

                   at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:112)

                   at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)

                   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                   at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)

                   at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)

                   at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)

                   ... 26 more

              Caused by: java.lang.NoClassDefFoundError: org/tranql/connector/jdbc/AbstractXADataSourceMCF

                   at java.lang.ClassLoader.defineClass1(Native Method)

                   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)

                   at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

                   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:183)

                   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:576)

                   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:546)

                   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:477)

                   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:465)

                   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:445)

                   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)

                   at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:381)

                   at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:33)

                   at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:445)

                   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)

                   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)

                   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)

                   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                   at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)

                   at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)

                   at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)

                   at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)

                   ... 31 more

              Caused by: java.lang.ClassNotFoundException: org.tranql.connector.jdbc.AbstractXADataSourceMCF

                   at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)

                   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)

                   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)

                   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)

                   at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

                   ... 52 more