tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Oracle XA with different credentials fails
Date Thu, 03 Nov 2016 18:28:03 GMT
2016-11-03 18:00 GMT+01:00 Zachary Bedell <zbedell@nycourts.gov>:

> 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.
>
>
Wrapping it doesnt require much knowledge I think. JdbcDriver value can be
controlled since it can be defined in resources.xml of if done at server
level you can add a jar in tomee/lib with your wrapper.


> 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.
>
>
Last note: here is the issue
https://issues.apache.org/jira/browse/TOMEE-1964 and here is the wrapper I
proposed you:
https://github.com/apache/tomee/blob/1b222cabd659ed661830ec4e11e995cadc556e48/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/xa/IsDifferentXaDataSourceWrapper.java


> -Zac
>
> > On Nov 3, 2016, at 11:15, Romain Manni-Bucau <rmannibucau@gmail.com>
> wrote:
> >
> > 2016-11-03 16:10 GMT+01:00 Zachary Bedell <zbedell@nycourts.gov>:
> >
> >> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message