I’m not very familiar with this configuration, but I don’t see any indication 
that the two datasources are connecting to different databases.  If they 
connect to the same database I think that is likely the source of the problem.  
There might possibly be an Oracle setting to allow this.  It might possibly be 
called something like loose coupling or tight coupling.  It would be better to 
change to one datasource per target database, however, as you would be making 
the database work much less with one xid rather than two.

david jencks

> On Apr 24, 2017, at 1:56 AM, Dignesh <dgo...@opentext.com> wrote:
> 
> I created two XA datasource and getting connection from both datasource in
> same transaction. I'm getting below exeception when i try to get connection
> from second data source
> 
> Caused by: java.sql.SQLException: Unable to enlist connection in
> transaction: enlistResource returns 'false'.
> at
> org.apache.openejb.resource.jdbc.managed.local.ManagedConnection.invoke(ManagedConnection.java:136)
> at com.sun.proxy.$Proxy82.prepareStatement(Unknown Source)
> 
> TomEE Version: 7.0.2
> Database: Oracle
> 
> Here are the datasource configurations
> 
>       <Resource id="jdbc/default" type="DataSource">
>               XaDataSource XA/Datasource
>               UserName $UserName$
>               Password $Password$
>               PasswordCipher TestCipher               
>               maxActive = 40
>               minIdle = 2
>               validationQuery = select 1 from dual
>               testOnBorrow = true
>               validationInterval = 30000
>       </Resource>
>       
>       <Resource id="jdbc/common" type="DataSource">
>               XaDataSource XA/Datasource
>               UserName $UserName$
>               Password $Password$
>               PasswordCipher TestCipher
>               maxActive = 20
>               minIdle = 2
>               validationQuery = select 1 from dual
>               testOnBorrow = true
>               validationInterval = 30000
>       </Resource>
>       
>       <Resource id="XA/Datasource"
> class-name="oracle.jdbc.xa.client.OracleXADataSource">
>               Url $JdbcUrl$           
>       </Resource>
> 
> Note: I'm not seeing this issue when i use PostgreSQL database
> 
> Thank You.
> 
> 
> 
> --
> View this message in context: 
> http://tomee-openejb.979440.n4.nabble.com/Unable-to-use-two-XA-Datasource-in-a-same-transaction-tp4681579.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.

Reply via email to