Hi: I am using oracle xa and bean managed transaction in my application----geronimo 2.1.4 & oracle 9i;
In my test ejb, just update a table in a bean-managed user-transaction;
The first time , my test ejb works, but if I execute the ejb twice, the
oracle-xa-transaction will failed;
In the attachment , I list my test ejb's program and oracle-xa-datasource's
plan; and also a simple simulate-program which doesn't use Geronimo
AppServer, but using Geronim-Transaction-Manager, and direct try oracle's XA
transaction;
The occured exception is :
2009-12-25 19:39:00,500 WARN [Transaction] Unable to enlist XAResource
org.apache.geronimo.transaction.manager.wrappernamedxaresou...@1e7dc51,
errorCode: -3
oracle.jdbc.xa.OracleXAException
at
oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
at
oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:295)
at
org.apache.geronimo.transaction.manager.WrapperNamedXAResource.start(Wrapper
NamedXAResource.java:86)
at
org.apache.geronimo.transaction.manager.TransactionImpl.enlistResource(Trans
actionImpl.java:209)
at
org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.getCo
nnection(TransactionEnlistingInterceptor.java:54)
at
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.getConn
ection(TransactionCachingInterceptor.java:87)
at
org.apache.geronimo.connector.outbound.ConnectionHandleInterceptor.getConnec
tion(ConnectionHandleInterceptor.java:43)
.......
at java.lang.Thread.run(Unknown Source)
javax.transaction.RollbackException: Unable to commit: transaction marked
for rollback
at
org.apache.geronimo.transaction.manager.TransactionImpl.rollbackResourcesDur
ingCommit(TransactionImpl.java:671)
at
org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionIm
pl.java:270)
at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(Transa
ctionManagerImpl.java:250)
at
org.apache.openejb.core.CoreUserTransaction.commit(CoreUserTransaction.java:
62)
at
org.apache.openejb.core.BaseContext$UserTransactionWrapper.commit(BaseContex
t.java:194)
at
sampleear.MyStatelessSessionBean.sayHello(MyStatelessSessionBean.java:40)
......
at java.lang.Thread.run(Unknown Source)
-----------------------------------------------------------------
While I havn't find the real-reason caused the exception ; but I noticed the
follow things:
1: when execute the test ejb first-time, although I have called the
userTransaction.commit(), but the oracle 's xa-transaction doesn't
real-complete.
2: I have write the program to simulate the critical-work which
Geronimo have done. In the simulate program , I direct use
Geronimo-transaction-manager and direct call the oracle-xa interface. And it
work's well; The simulator program also list in the attachment as
SimulateGeronimoTransaction.java
So I wondering if I have mis-used something in Geronimo, cause the
User-Transaction finished, but the oracle's real-xa-transaction doesn't
release.
Thanks for any suggest
I configed oracle-xa-datasource's plan is: <?xml version="1.0" encoding="UTF-8"?> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"> <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dep:moduleId> <dep:groupId>console.dbpool</dep:groupId> <dep:artifactId>oraclexatest1</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>rar</dep:type> </dep:moduleId> <dep:dependencies> <dep:dependency> <dep:groupId>oracle</dep:groupId> <dep:artifactId>oracle</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>jar</dep:type> </dep:dependency> </dep:dependencies> </dep:environment> <resourceadapter> <outbound-resourceadapter> <connection-definition> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface> <connectiondefinition-instance> <name>oraclexatest1</name> <config-property-setting name="NetworkProtocol">tcp</config-property-setting> <config-property-setting name="PortNumber">1521</config-property-setting> <config-property-setting name="TNSEntryName"/> <config-property-setting name="MaxStatements"/> <config-property-setting name="DataSourceName">OracleXADataSource</config-property-setting> <config-property-setting name="DriverType">thin</config-property-setting> <config-property-setting name="Password">changjun</config-property-setting> <config-property-setting name="ServerName">168.1.100.30</config-property-setting> <config-property-setting name="Description"/> <config-property-setting name="LoginTimeout"/> <config-property-setting name="DatabaseName"/> <config-property-setting name="ServiceName">ora9i30</config-property-setting> <config-property-setting name="UserName">changjun</config-property-setting> <connectionmanager> <xa-transaction> <transaction-caching/> </xa-transaction> <single-pool> <max-size>10</max-size> <min-size>0</min-size> <match-one/> </single-pool> </connectionmanager> </connectiondefinition-instance> </connection-definition> </outbound-resourceadapter> </resourceadapter>
MyStatelessSessionBean.java
Description: Binary data
SimulateGeronimoTransaction.java
Description: Binary data
