tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zachary Bedell <>
Subject Re: Oracle XA with different credentials fails
Date Thu, 03 Nov 2016 17:00:02 GMT
To do this on the driver side, I'd need to interpose behavior on OracleXAResource which is
returned by OracleXAConnection returned by OracleXADataSource.  I can control the JdbcDriver
class configured for TomEE, so I can override OracleXADataSource's getPooledConnection(Properties)
to start the process.  That method appears to be the delegate that all the get(Pooled)Connection()
methods call through.  

I *can't* control the construction of the OracleXAConnection or OracleXAResource, so I can't
directly sub-class them.  I'd have to wrap or proxy both of those classes.  Both of those
are concrete classes that lack an interface (or interfaces) that cover all of their methods,
so java.lang.reflect.Proxy can't directly do the job.  I'd need something like ProxyFactory
from Javassist to create proxies of the concrete classes.

That feels like it'll be brittle and requires a lot of internal knowledge of the Oracle classes
only available by reverse engineering them which raises some licensing concerns.

Would you be willing to entertain some modification of TomEE or geronimo-transactions instead?
 It seems like that approach would be more durable and also not potentially violate Oracle's
license on their JDBC driver.  The attribute that JBoss had wasn't Oracle specific but allowed
forcing isSameRM=false behavior for any type of datasource in cases where the driver or resource
adapter's implementation of isSameRM wasn't reliable.


> On Nov 3, 2016, at 11:15, Romain Manni-Bucau <> wrote:
> 2016-11-03 16:10 GMT+01:00 Zachary Bedell <>:
>> The only place I can find that would be able to wrap the XAResource is in
>> org.apache.openejb.resource.jdbc.managed.local.ManagedConnection#newConnection().
>> The assignment xaResource = xaConnection.getXAResource(); (line 186) could
>> interpose a wrapper or proxy.  It looks like everything that needs the
>> xaResource including the enlistResource() call in invoke() would get the
>> wrapped XAResource which could like about isSameRM().
> The proposal was to wrap oraclexadatasource to change getXAResource to impl
> it the way you want. That said geronimo-transaction uses an IdentityHashMap
> for that so means Oracle is really broken. Anyway this is few lines of code
> and solves the issue without modifying any class of tomee stack for this
> workaround.

View raw message