Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-1171

Aries transaction-jdbc invokes JDBC drivers getXAConnection(String username, String password) but passes null for both arguments

    XMLWordPrintableJSON

Details

    Description

      This is rather a bug in the tranql JDBC driver but since that project isn't so active anymore it may be better raised here.

      Consider an Oracle JDBC driver exposed as OSGi service such as in the following blueprint:

          <bean id="dataSource" class="oracle.jdbc.xa.client.OracleXADataSource" >
              <property name="URL" value="jdbc:oracle:thin:@localhost:1521:XE" />
              <property name="user" value="admin" />
              <property name="password" value="oracle" />
              <property name="connectionCachingEnabled" value="false" />
          </bean>
      
          <service interface="javax.sql.XADataSource" ref="dataSource">
            <service-properties>
              <entry key="osgi.jndi.service.name" value="jdbc/oracle"/>
              <entry key="datasource.name" value="Oracle"/>
            </service-properties>
          </service>
      

      When another bundle uses this driver to open a JDBC connection, it is most likely going to raise the following error (full error below [1]):

       java.sql.SQLException: Invalid argument(s) in call
      

      This particular error will only occur with the Oracle ojdbc6 JDBC driver.
      With MySQL 5.1.26 I did not have any problems but other JDBC drivers could potentially raise different errors.

      What that error means is that the call to the Oracle JDBC driver's

      public XAConnection getXAConnection(String userName, String passwd)
      

      passes in null for the username and password, which the driver does not like and raises the exception.

      The point is that we probably should not call getXAConnection(String userName, String passwd) if we have no credentials to pass in but instead use the method getXAConnection() so that the configured credentials of the JDBC driver are used.

      [1]
      org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Invalid argument(s) in call
      	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)[264:org.apache.servicemix.bundles.spring-jdbc:3.2.8.RELEASE_1]
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:575)[264:org.apache.servicemix.bundles.spring-jdbc:3.2.8.RELEASE_1]
      	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)[264:org.apache.servicemix.bundles.spring-jdbc:3.2.8.RELEASE_1]
      	at org.apache.camel.test.TestProcessor.insert(TestProcessor.java:55)[255:dts.filestore.routes-trimmed-6.1:1.0.0.SNAPSHOT]
      	at org.apache.camel.test.TestProcessor.process(TestProcessor.java:46)[255:dts.filestore.routes-trimmed-6.1:1.0.0.SNAPSHOT]
      	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:97)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:139)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:64)[142:org.apache.camel.camel-core:2.12.0.redhat-610379]
      	at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_45]
      	at java.util.TimerThread.run(Timer.java:505)[:1.7.0_45]
      Caused by: java.sql.SQLException: Invalid argument(s) in call
      	at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:209)[253:wrap_mvn_com.oracle_ojdbc6_11.2.0:0]
      	at org.tranql.connector.jdbc.AbstractXADataSourceMCF.getPhysicalConnection(AbstractXADataSourceMCF.java:76)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.tranql.connector.jdbc.AbstractXADataSourceMCF.createManagedConnection(AbstractXADataSourceMCF.java:66)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.MCFConnectionInterceptor.getConnection(MCFConnectionInterceptor.java:48)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.XAResourceInsertionInterceptor.getConnection(XAResourceInsertionInterceptor.java:41)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.internalGetConnection(SinglePoolConnectionInterceptor.java:70)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.getConnection(AbstractSinglePoolConnectionInterceptor.java:80)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getConnection(TransactionEnlistingInterceptor.java:49)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConnection(TransactionCachingInterceptor.java:109)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnection(ConnectionHandleInterceptor.java:43)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.TCCLInterceptor.getConnection(TCCLInterceptor.java:39)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor.getConnection(ConnectionTrackingInterceptor.java:66)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.apache.geronimo.connector.outbound.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:81)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at org.tranql.connector.jdbc.TranqlDataSource.getConnection(TranqlDataSource.java:62)[118:org.apache.aries.transaction.jdbc:1.0.1.redhat-610379]
      	at Proxy1fba8d14_d2b7_481d_86bd_bdb4e72fa591.getConnection(Unknown Source)[:]
      	at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)[264:org.apache.servicemix.bundles.spring-jdbc:3.2.8.RELEASE_1]
      	at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)[264:org.apache.servicemix.bundles.spring-jdbc:3.2.8.RELEASE_1]
      	... 15 more
      

      Attachments

        1. ARIES-1171.patch
          2 kB
          Torsten Mielke

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              tmielke Torsten Mielke
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: