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

Grzegorz Grzybek edited comment on DBCP-570 at 3/12/21, 12:41 PM:
------------------------------------------------------------------

I've just reproduced the problem with podman-based Oracle DB and driver from 
https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/21.1.0.0/

{noformat}
13:37:21 WARN [arjunacore.TransactionImple] (TransactionImple.java:766) : 
ARJUNA016138: Failed to enlist XA resource 
oracle.jdbc.driver.T4CXAResource@dbd8e44
oracle.jdbc.xa.OracleXAException: XAErr (-3): A resource manager error has 
occured in the transaction branch. ORA-24774 SQLErr (0)
        at 
oracle.jdbc.xa.OracleXAResource.convertError(OracleXAResource.java:1142) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at 
oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:253) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at 
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:740)
 [jta-5.10.6.Final.jar:5.10.6.Final]
        at 
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:422)
 [jta-5.10.6.Final.jar:5.10.6.Final]
        at 
org.ops4j.pax.jdbc.pool.dbcp2.impl.PooledDataSourceXATest.jtaTest(PooledDataSourceXATest.java:187)
 [test-classes/:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_281]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_281]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_281]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_281]
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
[junit-4.13.1.jar:4.13.1]
        at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) 
[junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
 [junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) 
[junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
 [junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137) 
[junit-4.13.1.jar:4.13.1]
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
 [junit-rt.jar:?]
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
 [junit-rt.jar:?]
        at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
 [junit-rt.jar:?]
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) 
[junit-rt.jar:?]
Caused by: java.sql.SQLException: ORA-24774: cannot switch to specified 
transaction

        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:628) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:557) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:552) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1312) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:726) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:291) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIOtxse.doOTXSE(T4CTTIOtxse.java:175) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CXAResource.doStart(T4CXAResource.java:217) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at 
oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:248) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        ... 30 more
{noformat}


was (Author: gzres):
I've just reproduced the problem with podman-based Oracle DB and driver from 
https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/21.1.0.0/:

{noformat}
13:37:21 WARN [arjunacore.TransactionImple] (TransactionImple.java:766) : 
ARJUNA016138: Failed to enlist XA resource 
oracle.jdbc.driver.T4CXAResource@dbd8e44
oracle.jdbc.xa.OracleXAException: XAErr (-3): A resource manager error has 
occured in the transaction branch. ORA-24774 SQLErr (0)
        at 
oracle.jdbc.xa.OracleXAResource.convertError(OracleXAResource.java:1142) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at 
oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:253) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at 
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:740)
 [jta-5.10.6.Final.jar:5.10.6.Final]
        at 
com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:422)
 [jta-5.10.6.Final.jar:5.10.6.Final]
        at 
org.ops4j.pax.jdbc.pool.dbcp2.impl.PooledDataSourceXATest.jtaTest(PooledDataSourceXATest.java:187)
 [test-classes/:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[?:1.8.0_281]
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
~[?:1.8.0_281]
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_281]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_281]
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
[junit-4.13.1.jar:4.13.1]
        at 
org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) 
[junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
 [junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) 
[junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
 [junit-4.13.1.jar:4.13.1]
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
 [junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413) 
[junit-4.13.1.jar:4.13.1]
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137) 
[junit-4.13.1.jar:4.13.1]
        at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
 [junit-rt.jar:?]
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
 [junit-rt.jar:?]
        at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
 [junit-rt.jar:?]
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) 
[junit-rt.jar:?]
Caused by: java.sql.SQLException: ORA-24774: cannot switch to specified 
transaction

        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:628) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:557) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:552) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1312) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:726) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:291) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CTTIOtxse.doOTXSE(T4CTTIOtxse.java:175) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at oracle.jdbc.driver.T4CXAResource.doStart(T4CXAResource.java:217) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        at 
oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:248) 
~[ojdbc8-21.1.0.0.jar:21.1.0.0.0]
        ... 30 more
{noformat}

> Oracle transaction issue
> ------------------------
>
>                 Key: DBCP-570
>                 URL: https://issues.apache.org/jira/browse/DBCP-570
>             Project: Commons DBCP
>          Issue Type: Bug
>    Affects Versions: 2.8.0
>            Reporter: Aaron Ogburn
>            Priority: Major
>         Attachments: test.zip
>
>
> A failure can be seen when using two connections from different DBCP pools to 
> access Oracle in a single transaction. The pools must access the same 
> database server/SID but the users must be different. In such cases, Oracle 
> has issues that result in a failure at the point of connection enlistment:
> {code:java}
>  ... WARN [main] sun.reflect.NativeMethodAccessorImpl.invoke0 ARJUNA016089: 
> TransactionImple.enlistResource - xa_start - caught: XAException.XAER_RMERR 
> for < formatId=131077, gtrid_length=29, bqual_length=36, 
> tx_uid=0:ffff0a000264:a0d3:5fdbca1d:a, node_name=1, 
> branch_uid=0:ffff0a000264:a0d3:5fdbca1d:c, subordinatenodename=null, 
> eis_name=0 >
>  oracle.jdbc.xa.OracleXAException: XAErr (-3): A resource manager error has 
> occured in the transaction branch. ORA-24774 SQLErr (0)
>  at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1092)
>  at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:272)
>  at 
> com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:741)
>  at 
> com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:423)
>  at 
> org.apache.tomcat.dbcp.dbcp2.managed.TransactionContext.setSharedConnection(TransactionContext.java:109)
>  at 
> org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:157)
>  at 
> org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:75)
>  at 
> org.apache.tomcat.dbcp.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:80)
>  at 
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
>  at 
> support.jboss.web.TransactionTest.executeSQL(TransactionTest.java:84){code}
>  We also verified that the explanation/presumed cause is correct by using a 
> Byteman based workaround (which is probably *too* aggressive for some cases 
> but does work around the problem scenario) that simulates what is done by 
> IronJacamar and what is suggested/discussed in [1] - i.e. force the 
> OracleXAResource "true" return for isSameRM to be "false" (instead) via a 
> proxy for the OracleXAResource implementation.
> {code:java}
> RULE oracle.jdbc.xa.OracleXAResource.isSameRM.FALSE
> CLASS oracle.jdbc.xa.OracleXAResource
> METHOD isSameRM
> AT ENTRY
> IF true
> DO System.err.println("[BMAN] Overriding Oracle isSameRM ...");
>  return false;
> ENDRULE{code}
> Is it possible for DBCP to better handle this Oracle specific scenario?
> [1] 
> [http://www.tomee-openejb.979440.n4.nabble.com/Oracle-XA-with-different-credentials-fails-td4680456.html]
> [2] 
> [https://community.oracle.com/tech/developers/discussion/1058320/ora-24774-why-does-xa-start-fails-for-2-txn-branches-on-same-instance]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to