Atomikos Forum

MySQL AtomikosDataSourceBean transaction issues...

According to the documentation, Atomikos supports MySQL for XA transactions.  However, it seems that MySQL actually has not implemented certain functionality expected my Atomikos and it results in transaction problems.

I'm using MySQL 5.1 with MySQL Connector/J 5.1.8.

Here is my datasource configuration:
<bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean">
      <property name="uniqueResourceName" value="dataSource"/>
      <property name="xaDataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"/>
      <property name="xaProperties">
          <props>
              <prop key="url">${jdbc.url}</prop>
            <prop key="user">${jdbc.username}</prop>
              <prop key="password">${jdbc.password}</prop>
          </props>
      </property>
      <property name="minPoolSize" value="10" />
      <property name="maxPoolSize" value="100" />
      <property name="borrowConnectionTimeout" value="30" />
      <property name="testQuery" value="select 1" />
      <property name="maintenanceInterval" value="60" />
    </bean>

I am getting the following error message when trying to join an existing transaction while using the MySQL XA driver:

Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: createCompositeTransaction ( 10000 ): created new ROOT transaction with id com.atomikos.spring.jdbc.tm0001700017
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: AtomikosDataSoureBean 'dataSource': getConnection ( null )...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: AtomikosDataSoureBean 'dataSource': init...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling toString...
Hibernate: /* named HQL query SysConfig.findByTheme */ select sysconfig0_.id as id52_, sysconfig0_.created_by_user_id as created7_52_, sysconfig0_.date_created as date2_52_, sysconfig0_.__UUID__ as column3_52_, sysconfig0_.obj_version as obj4_52_, sysconfig0_.date_updated as date5_52_, sysconfig0_.updated_by_user_id as updated8_52_, sysconfig0_.theme as theme52_ from sys_config sysconfig0_ where sysconfig0_.theme=? limit ?
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling toString...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: addParticipant ( XAResourceTransaction: 636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D30303031373030303137:636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D3134 ) for transaction com.atomikos.spring.jdbc.tm0001700017
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: XAResource.start ( 636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D30303031373030303137:636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D3134 , XAResource.TMNOFLAGS ) on resource dataSource represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection@13e8e8a
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling prepareStatement...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: isClosed()...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling getWarnings...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling clearWarnings...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: close()...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: XAResource.end ( 636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D30303031373030303137:636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D3134 , XAResource.TMSUCCESS ) on resource dataSource represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection@13e8e8a
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: AtomikosDataSoureBean 'dataSource': getConnection ( null )...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: AtomikosDataSoureBean 'dataSource': init...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling toString...
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: atomikos connection proxy for com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper@4c2849: calling toString...
Hibernate: /* load one-to-many com.lf.model.config.SysConfig.items */ select items0_.sys_config_id as sys11_1_, items0_.id as id1_, items0_.id as id21_0_, items0_.created_by_user_id as created9_21_0_, items0_.date_created as date2_21_0_, items0_.__UUID__ as column3_21_0_, items0_.obj_version as obj4_21_0_, items0_.date_updated as date5_21_0_, items0_.updated_by_user_id as updated10_21_0_, items0_.description as descript6_21_0_, items0_.name as name21_0_, items0_.sys_config_id as sys11_21_0_, items0_.value as value21_0_ from sys_config_items items0_ where items0_.sys_config_id=?
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: addParticipant ( XAResourceTransaction: 636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D30303031373030303137:636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D3134 ) for transaction com.atomikos.spring.jdbc.tm0001700017
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
INFO: XAResource.start ( 636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D30303031373030303137:636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D3134 , XAResource.TMJOIN ) on resource dataSource represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection@13e8e8a
Sep 4, 2009 2:00:14 PM com.atomikos.diagnostics.Slf4jConsole println
WARNING: XA resource 'dataSource': resume for XID '636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D30303031373030303137:636F6D2E61746F6D696B6F732E737072696E672E6A6462632E746D3134' raised -5: invalid arguments were given for the XA operation
com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:600)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:583)
    at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:523)
    at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:647)
    at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:32)
    at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:41)
    at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:60)
    at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:151)
    at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:172)
    at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:106)
    at $Proxy36.prepareStatement(Unknown Source)
    at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
    at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
    at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1577)
    at org.hibernate.loader.Loader.doQuery(Loader.java:696)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.loadCollection(Loader.java:2019)
    at org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:75)
    at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
    at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
    at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1744)
    at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476)
    at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:867)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:264)
    at org.hibernate.loader.Loader.doList(Loader.java:2232)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
    at org.hibernate.loader.Loader.list(Loader.java:2124)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
    at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:88)
    at com.lf.service.config.SysConfigServiceImpl.getSysConfigByTheme(SysConfigServiceImpl.java:103)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy52.getSysConfigByTheme(Unknown Source)
    at com.lf.service.context.AppContextServiceImpl.getValidAppContextByUUIDAndType(AppContextServiceImpl.java:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy55.getValidAppContextByUUIDAndType(Unknown Source)
    at com.lf.web.filter.InboundFilter.doFilter(InboundFilter.java:154)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:112)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)


Any clues what might be the problem?  Or more importantly the fix?

I can get the code to work by using the AtomikosNonXADataSourceBean, but I need XA support.
Caine Send private email
Friday, September 04, 2009
 
 
Hi!

It is impossible to use XA transaction with MySQL. As you see: http://dev.mysql.com/doc/refman/5.0/en/xa-restrictions.html mysql doesn't fully support distributed transaction. I was playing few weeks with MySQL and XA (atomikos or jotm) to made it works but it impossible.
Jakub Bialek Send private email
Tuesday, September 08, 2009
 
 
Can we get some confirmation of this from development?

I am running into the same exception:

com.mysql.jdbc.jdbc2.optional.MysqlXAException: XAER_INVAL: Invalid arguments (or unsupported command)

And I have configured my jta.properties with:

com.atomikos.icatch.serial_jta_transactions=false

as suggested in the workaround.

Is it true that for versions 5.0 and 5.1 of MySQL, XA is not functioning?
Ara Vartanian Send private email
Saturday, September 26, 2009
 
 
Hi,

We didn't check lately, but we can certainly invest some extra time in figuring this out if you have the budget for dev support.

Thanks
Guy Pardon Send private email
Sunday, September 27, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics