Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-360

BasicManagedDataSource fails with OracleXADataSource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.4
    • None
    • None

    Description

      Using the same JDBC url and settings as in non-XA (driverClassName) mode, the BasicManagedDataSource will fail when it attempts to obtain an Oracle connection when using the Oracle oracle.jdbc.xa.client.OracleXADataSource datasource class.

      It appears that BasicManagedDataSource.createConnectionFactory is never actually setting the URL (I can't tell where if at all it is set, the exception must occur before then).

      <bean id="riceDataSource" class="org.apache.commons.dbcp.managed.BasicManagedDataSource" destroy-method="close">
      <property name="transactionManager" ref="jotm" />
      <property name="url" value="${datasource.url}"/>
      <property name="XADataSource" value="${xadatasource.class}"/>
      <property name="maxActive" value="${datasource.pool.maxActive}"/>
      <property name="minIdle" value="${datasource.minIdle}" />
      <property name="initialSize" value="${datasource.initialSize}"/>
      <property name="validationQuery" value="${datasource.pool.validationQuery}"/>
      <property name="username" value="${datasource.username}" />
      <property name="password" value="${datasource.password}" />
      <property name="accessToUnderlyingConnectionAllowed" value="${datasource.accessToUnderlyingConnectionAllowed}"/>
      <property name="connectionProperties"><value>driverType=thin;portNumber=1521</value></property> <!-- as rumored on the internets -->
      </bean>

      org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Invalid Oracle URL specified: OracleDataSource.makeURL)
      Caused by: java.sql.SQLException: Cannot create PoolableConnectionFactory (Invalid Oracle URL specified: OracleDataSource.makeURL)
      at org.apache.commons.dbcp.managed.BasicManagedDataSource.createPoolableConnectionFactory(BasicManagedDataSource.java:200)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
      at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:276)
      at ConnectionTest$1.doInTransaction(ConnectionTest.java:79)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
      at ConnectionTest.testConnectionRecovery(ConnectionTest.java:76)
      at ConnectionTest.testOracleBMDSXARecovery(ConnectionTest.java:58)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
      at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
      at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
      at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
      at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
      at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
      at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
      at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
      at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
      at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
      at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
      at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
      at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1353)
      at oracle.jdbc.pool.OracleDataSource.getURL(OracleDataSource.java:1064)
      at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:204)
      at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:159)
      at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:133)
      at org.apache.commons.dbcp.managed.DataSourceXAConnectionFactory.createConnection(DataSourceXAConnectionFactory.java:103)
      at org.apache.commons.dbcp.managed.PoolableManagedConnectionFactory.makeObject(PoolableManagedConnectionFactory.java:103)
      at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
      at org.apache.commons.dbcp.managed.BasicManagedDataSource.createPoolableConnectionFactory(BasicManagedDataSource.java:196)
      ... 31 more

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aaron Aaron Bannert
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: