JBoss 2.4.4, Oracle and Transactions
bartmann_d Mar 7, 2002 4:45 AMFirst of all my main question: Is there anyone out there who uses JBoss 2.4.4 together with Oracle without having the same problems that I have and if so, which driver do you use?
Now to the whole story:
We switched from Bea to JBoss last year and were really happy ... until we encountered the bug I reported in November (http://sourceforge.net/tracker/?func=detail&atid=376685&aid=486416&group_id=22866): in some cases the Oracle DB is not updated when a transaction commits (see also the topic http://main.jboss.org/thread.jsp?forum=46&thread=6016). For details check out the bug report. I've attached a complete very small example so you can easily test your own installation.
This bug was a no-go for us and hence we switched to the sun J2EE RI. Because of the many advantages of JBoss (and some other reasons) we want to switch back now. Unfortunately the bug still exists with JBoss 2.4.4, Oracle 8.1.6 and JDK 1.3.1_01 and so I've been searching and reading a lot the last days and also tried a lot of settings ... and that's what I found out:
1. The mentioned bug only occurs with the jboss xa wrapper:
OracleDB
org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
...
2. When using the oracle XADataSource (Oracle thin driver 9.0.1) together with the oracle Xid implementation ...
300
oracle.jdbc.xa.OracleXid
OracleDB
oracle.jdbc.xa.client.OracleXADataSource
...
... the bug vanishes but unfortunately I'm getting an OracleXAException every time I'm trying to get a connection within a transaction context that has been initiated by the container (UserTransactions initiated by the client work well)(see also the topic http://main.jboss.org/thread.jsp?forum=46&thread=9798)
[WARN,TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=pctr310//6, BranchQual=] errorCode=XAER_RMERR
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:659)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:197)
at org.jboss.tm.TxCapsule.startResource(TxCapsule.java:1088)
at org.jboss.tm.TxCapsule.enlistResource(TxCapsule.java:615)
at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:111)
at org.jboss.pool.jdbc.xa.XAConnectionFactory.prepareObject(Unknown Source)
at org.jboss.pool.ObjectPool.getObject(Unknown Source)
at org.jboss.pool.ObjectPool.getObject(Unknown Source)
at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(Unknown Source)
at dbcommitbug.DBCommitBugEJB.getConnection(DBCommitBugEJB.java:252)
at dbcommitbug.DBCommitBugEJB.ejbLoad(DBCommitBugEJB.java:106)
at java.lang.reflect.Method.invoke(Native Method)
at org.jboss.ejb.plugins.BMPPersistenceManager.loadEntity(BMPPersistenceManager.java:324)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:287)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:197)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:125)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:138)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:100)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:127)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:170)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:428)
at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:410)
at java.lang.reflect.Method.invoke(Native Method)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
at sun.rmi.transport.Transport$1.run(Transport.java:152)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
at java.lang.Thread.run(Thread.java:484)
when executing the client:
...
Context ctx = new InitialContext();
Object ref = ctx.lookup("DBCommitBug");
DBCommitBugHome bugHome = (DBCommitBugHome) PortableRemoteObject.narrow(ref, DBCommitBugHome.class);
DBCommitBug bugEJB = bugHome.create("Test");
UserTransaction ut = (UserTransaction)ctx.lookup("UserTransaction");
ut.begin();
bugEJB.setValue(42); // works without exception
ut.commit();
ut.begin();
bugEJB.getValue(); // works without exception
ut.rollback();
int val = bugEJB.getValue(); // exception first time
bugEJB.remove(); // exception second time
...
ejb.jar.xml:
...
<assembly-descriptor>
<container-transaction>
<ejb-name>DBCommitBug</ejb-name>
<method-name>*</method-name>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
When I change the transaction attribute from Required to Supports, everything works fine (however that can't be the solution ...)
3. According to another JBoss user everything works fine with MySQL and the MM.MySQL driver.
I would be very happy if someone could give me a hint. I would also buy an Oracle driver if this solved my problems. Thx for reading this awfully long posting ...