Uploaded image for project: 'Agroal'
  1. Agroal
  2. AG-210

Spring XML: unable to set jtaTransactionIntegration with transactionManager ref

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 2.3
    • 1.18, 2.2
    • spring
    • None
    • False
    • None
    • False

      I'm using Spring XML to define the agroal datasource like this:

       

      <bean id="tm" class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple"/>
      <bean id="ut" class="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple"/>
      <bean name="tsr" class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple"/>
      
      <bean id="jtaTm" class="org.springframework.transaction.jta.JtaTransactionManager">
          <property name="transactionManager" ref="tm"/>
          <property name="userTransaction" ref="ut"/>
          <property name="transactionSynchronizationRegistry" ref="tsr"/>
      </bean>
      
      <bean name="agroalDataSource" class="io.agroal.springframework.boot.AgroalDataSource">
          <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
          <property name="url" value="${mysql.url}"/>
          <property name="username" value="${mysql.user}"/>
          <property name="password" value="${mysql.password}"/>
          <property name="jtaTransactionIntegration" ref="jtaTm"/>
      </bean>
      

      This works OK with 1.17, but fails in 1.18 with:

      Caused by: java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.transaction.jta.JtaTransactionManager' to required type 'io.agroal.api.transaction.TransactionIntegration' for property 'jtaTransactionIntegration': no matching editors or conversion strategy found
      

      The fix for AG-206 added an overloaded method setJtaTransactionIntegration(TransactionIntegration transactionIntegration) which causes the issue.

      I can workaround the issue by defining a io.agroal.narayana.NarayanaTransactionIntegration bean and passing that one to the jtaTransactionIntegration property, but it would probably be better if the two setter methods had distinct names - maybe something like setJtaTransactionIntegration and setJtaTransactionManager?

              lbarreiro-1 Luis Barreiro
              avano@redhat.com Andrej Vano
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: