6 Replies Latest reply on Apr 8, 2002 1:41 PM by fritz

    JBoss 2.4.4, Oracle and Transactions

    bartmann_d

      First 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 ...

        • 1. Re: JBoss 2.4.4, Oracle and Transactions
          davidjencks

          I don't see the attachment...

          I won't look at XADataSourceLoader without being paid... but I am interested in getting oracle xa working with jboss 3 and the jca-jdbc wrappers. If we can get that working and you still need to use a jboss 2.x version the config can probably be back-ported without too much difficulty.

          This would be much easier if I could get Oracle running...

          Does the problem occur only when the server is under heavy load?

          • 2. Re: JBoss 2.4.4, Oracle and Transactions
            bartmann_d

            Oh, sorry for my posting being a bit confusing. I attached the sample code to my bug report (http://sourceforge.net/tracker/?func=detail&atid=376685&aid=486416&group_id=22866 ). The problem is independent of the server's load and even occurs when my test client is the only one talking to the server.

            I appreciate every help I can get and if you think we can do it via jboss 3 so let's try ...

            Thx a lot

            • 3. Re: JBoss 2.4.4, Oracle and Transactions
              cwstanton

              I am in the early stages of porting a J2EE application over from another app server to JBoss, and I have recieved the same OracleXAException when the code executes. I am using JBoss 2.4.4 on Solaris 8 with the Oracle-provided XA DataSource. I tried it with the JBoss-provided XA DataSource, and I recvd Exceptions when any of my CLOB code executed. All of my database interactions are in methods declared as transaction Required, except my CLOB code which is declared as transaction NotSupported. And, I am using the default JBoss transaction manager. (Does the Tyrex TM solve any of these issues?)

              I am very curious to know if you have overcome the OracleXAExceptions, and if so, how?

              • 4. Re: JBoss 2.4.4, Oracle and Transactions
                dlynes

                &gt; I am very curious to know if you have overcome the
                &gt; OracleXAExceptions, and if so, how?

                I started running into this problem when I tried changing it from 'Bean' managed transaction to 'Container' managed transaction. However, when using 'Bean' managed transaction, I wasn't aware of having to use the UserTransaction interface, or having to use the OracleXid interface (wasn't mentioned anywhere before...only in the config file, and uncommenting it seemed to cause JBoss not to work in earlier versions). So, I was just merrily going along, without commits or rollbacks, with a Connection received from a DataSource that was allocated from an XADataSourcePool using Oracle XADataSource implementation.

                I was finding that the LOB error was caused by data not having been committed on a previous transaction. i.e. JBoss still had the connection open, had submitted insert operation (with the empty lob), hadn't committed it, and possibly had submitted the lob data as well (and not committed it). The reason I know this is that the application could see the data in the database, but when I did a separate query, it wasn't showing.

                Maybe this will help others to be able to figure out what's going on with Oracle/JBoss.

                I'm using Blackdown JVM 1.3.0 with JBoss 2.4.4, and I'm using Tomcat 3.2.3 with Sun JVM 1.3.1_02 under Linux 2.4.5 with GLIBC 2.2.3 (Slackware 8.0). Tomcat is running under Forte 3.0 CE with Jumbo Patch 3.2. The memory on the machine is 512MB's with a 1GB swap partition. No kernel modifications have been made to support threading optimizations of any kind.

                • 5. Re: JBoss 2.4.4, Oracle and Transactions
                  davidjencks

                  If anyone is interested in working on an xa driver configuration for jboss 3 I posted a template and some basic instructions:

                  http://main.jboss.org/thread.jsp?forum=46&thread=10750

                  • 6. Re: JBoss 2.4.4, Oracle and Transactions
                    fritz

                    I'm having the same problem you are and am desparately looking for a solution. I've noticed that Oracle doesn't throw the exception when used with the Tyrex TM. However, I haven't yet figured out how to properly configure Tyrex, so I can't say that the problem is solved. Have you made any further discoveries?