Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-122

Raised -5: invalid arguments were given for the XA operation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.7
    • Fix Version/s: 1.1.8
    • Component/s: None
    • Labels:
      None
    • Environment:
      OS: Unix based
      Server: Tomcat 7
      JVM: 1.7.0_51
      External Java libraries: Atomikos 3.9.3, Hibernate 4.1.4, Spring 3.1.2

      Description

      Hi,

      we are migrating the java db connector from mysql 5.1.18 to mariadb 1.1.7
      Our system depends of two different MariaDB databases and we are doing XA transaction between them. To implement JTA transactions in Java we use Atomikos (http://www.atomikos.com/Main/TransactionsEssentials).

      The datasources spring configuration look as follow:

      	<bean id="db1XADataSource" 
      		  class="com.atomikos.jdbc.AtomikosDataSourceBean" 
      		  init-method="init" 
      		  destroy-method="close"
      		  lazy-init="true">
      		<property name="xaDataSourceClassName" value="org.mariadb.jdbc.MySQLDataSource"/>
      		<property name="uniqueResourceName" value="db1XADataSource"/>    
      		<property name="minPoolSize" value="${db1.jdbc.minPoolSize}" />
      	    <property name="maxPoolSize" value="${db1.jdbc.maxPoolSize}" />  
      	    <property name="maxIdleTime" value="${db1.jdbc.maxIdleTime}" />
      	    <property name="maxLifetime" value="${db1.jdbc.maxLifetime}" /> 
      		<property name="xaProperties">
      	        <props>
      	            <prop key="url">jdbc:mariadb://localhost:3306/db1?autoReconnect=true</prop>
      	            <prop key="user">userdb1</prop>
      	            <prop key="password">pwddb1</prop>
      	        </props>
      	    </property>
      	</bean>
       
      	<bean id="db2XADataSource" 
      		  class="com.atomikos.jdbc.AtomikosDataSourceBean" 
      		  init-method="init" 
      		  destroy-method="close"
      		  lazy-init="true">
      	    <property name="xaDataSourceClassName" value="org.mariadb.jdbc.MySQLDataSource"/>
      	    <property name="uniqueResourceName" value="db2XADataSource"/>    
      	    <property name="minPoolSize" value="${db2.jdbc.minPoolSize}" />
      	    <property name="maxPoolSize" value="${db2.jdbc.maxPoolSize}" />
      	    <property name="maxIdleTime" value="${db2.jdbc.maxIdleTime}" />
      	    <property name="maxLifetime" value="${auditlog.jdbc.maxLifetime}" />   
      	    <property name="xaProperties">
      	        <props>
      	            <prop key="url">jdbc:mariadb://localhost:3306/db2?autoReconnect=true</prop>
      	            <prop key="user">userdb2</prop>
      	            <prop key="password">pwddb2</prop>
      	        </props>
      	    </property>
      	</bean>

      Trying to perform an XA transaction we have the following exception "invalid arguments were given for the XA operation":

      Nov 17, 2014 10:05:47 AM com.atomikos.logging.Slf4jLogger logInfo
      INFO: XAResource.start ( 61646D696E41746F6D696B6F73544D30303030313030313839:61646D696E41746F6D696B6F73544D31 , XAResource.TMJOIN ) on resource domainXADataSource represented by XAResource instance org.mariadb.jdbc.MySQLXAResource@88ee298
      Nov 17, 2014 10:05:47 AM com.atomikos.logging.Slf4jLogger logWarning
      WARNING: XA resource 'domainXADataSource': resume for XID '61646D696E41746F6D696B6F73544D30303030313030313839:61646D696E41746F6D696B6F73544D31' raised -5: invalid arguments were given for the XA operation
      javax.transaction.xa.XAException
      	at org.mariadb.jdbc.MySQLXAResource.mapXAException(MySQLXAResource.java:41)
      	at org.mariadb.jdbc.MySQLXAResource.execute(MySQLXAResource.java:51)
      	at org.mariadb.jdbc.MySQLXAResource.start(MySQLXAResource.java:148)
      	at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:427)
      	at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.<init>(BranchEnlistedStateHandler.java:59)
      	at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:64)
      	at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:88)
      	at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:179)
      	at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:223)
      	at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:142)
      ....
      ....
      ....

      This is a documented issue in Atomikos (http://www.atomikos.com/Documentation/KnownProblems#MySQL_does_not_support_TMJOIN) and it was solved with MySQL adding the following parameter to the URL connection string : &pinGlobalTxToPhysicalConnection=true

      After migrate the java connector to MariaDB it seems that this parameter is not available for the connector being impossible to run the application.

      Best regards

        Attachments

          Activity

            People

            Assignee:
            massimo.siani Massimo Siani (Inactive)
            Reporter:
            damartin David Martin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.