You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Torsten Mielke (JIRA)" <ji...@apache.org> on 2014/04/11 16:15:23 UTC

[jira] [Comment Edited] (ARIES-1171) Aries transaction-jdbc invokes JDBC drivers getXAConnection(String username, String password) but passes null for both arguments

    [ https://issues.apache.org/jira/browse/ARIES-1171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13966541#comment-13966541 ] 

Torsten Mielke edited comment on ARIES-1171 at 4/11/14 2:14 PM:
----------------------------------------------------------------

A current workaround is to also set the username and password as service properties when exporting the JDBC driver as an OSGi service:

{code:xml}
    <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"/>
        <entry key="aries.xa.username" value="admin"/>
        <entry key="aries.xa.password" value="oracle"/>
      </service-properties>
    </service>
{code}

That way the the call to getXAConnection() correctly passes in the configured username and password.



was (Author: tmielke):
A current workaround is to also set the username and password as service properties when exporting the JDBC driver as an OSGi service:

{code:title=blueprint.xml}
    <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"/>
        <entry key="aries.xa.username" value="admin"/>
        <entry key="aries.xa.password" value="oracle"/>
      </service-properties>
    </service>
{code}

That way the the call to getXAConnection() correctly passes in the configured username and password.


> Aries transaction-jdbc invokes JDBC drivers getXAConnection(String username, String password) but passes null for both arguments
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-1171
>                 URL: https://issues.apache.org/jira/browse/ARIES-1171
>             Project: Aries
>          Issue Type: Bug
>          Components: Transaction
>    Affects Versions: blueprint-core-1.0.1
>            Reporter: Torsten Mielke
>            Assignee: Guillaume Nodet
>              Labels: XA, jdbc, security, transaction
>         Attachments: ARIES-1171.patch
>
>
> 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:
> {code:xml}
>     <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>
> {code}
> 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]):
> {code}
>  java.sql.SQLException: Invalid argument(s) in call
> {code}
> 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
> {code}
> public XAConnection getXAConnection(String userName, String passwd)
> {code}
> 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. 
> {code}
> [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
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)