1 2 Previous Next 15 Replies Latest reply on Aug 11, 2006 7:01 PM by moisesjboss

    Using oracle thin and OCI driver in transactions fails

    moisesjboss

      I jave 2 jboss servers, each configured with jbossts. An ejb client calls bean1 in server1 and bean2 in server2 within a transaction. The beans do simple database inserts. Server1 uses oracle thin driver, and server2 uses oracle OCI driver (both 10g), and the combination fails...

      If I use thin driver in both servers then there is no errors. Is it a requirement not mix drivers in transactions?

      Error from server2 using OCI driver:

      2006-07-06 14:06:42,467 WARN [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.resources.jts.orbspecific.xaerror] [com.arjuna.ats.internal.jta.resources.jts.orbspecific.xaerror] XAResourceRecord.rollback caused an XA error: XAException.XAER_RMERR
      2006-07-06 14:06:42,482 WARN [jacorb.poa.controller] rid: 10 opname: _is_a cannot process request, because object doesn't exist
      2006-07-06 14:06:42,482 WARN [jacorb.poa.controller] rid: 10 opname: _is_a request rejected with exception:
      2006-07-06 14:06:42,498 WARN [jacorb.poa.controller] rid: 8 opname: rollback cannot process request, because object doesn't exist
      2006-07-06 14:06:42,498 WARN [jacorb.poa.controller] rid: 8 opname: rollback request rejected with exception:

      And this is the error in server1. The client bean is also running in server1:

      14:06:03,910 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_36] - BasicAction.End() - prepare phase of action-id a68017a:fde:44ad67ce:226 failed.
      14:06:03,910 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_38] - Action Aborting
      14:06:03,942 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract void com.abc.txsample1.TxFacadeSession.doWork(com.abc.txsample1.TxSample1VO) throws java.rmi.RemoteException,com.abc.txsample1.ApplicationException, causedBy:
      javax.transaction.RollbackException
      at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.commit(TransactionImple.java:261)
      at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      14:06:03,942 ERROR [STDERR] org.jboss.tm.JBossTransactionRolledbackException: null; nested exception is:
      javax.transaction.RollbackException; - nested throwable: (javax.transaction.RollbackException)
      14:06:03,942 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.throwJBossException(TxInterceptorCMT.java:569)
      14:06:03,942 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:506)
      14:06:03,942 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
      14:06:03,942 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      14:06:03,942 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)

        • 1. Re: Using oracle thin and OCI driver in transactions fails
          marklittle

          Attach a debugger and send as much information about the exception as you can get.

          • 2. Re: Using oracle thin and OCI driver in transactions fails
            moisesjboss

            I have replaced the OCI driver with the latest Informix xa drivers and I get the same exception and messages. I am not sure if the issues are related to the JDBC drivers or to the TX server. The informix driver even fails during a one-phase-commit (where the transaction is started by a remote ejb client)

            Can you tell me what particular area should I look into with the debugger, or what parameters/states I should expect to be there?

            Here is the one-phase-commit exception:

            11:09:25,919 WARN [loggerI18N] [com.arjuna.ats.internal.jta.resources.jts.orbspecific.xaerror] [com.arjuna.ats.internal.jta.resources.jts.orbspecific.xaerror]XAResourceRecord.commit_one_phase caused an XA error: XAException.XAER_PROTO
            11:09:25,919 INFO [STDOUT] javax.transaction.xa.XAException
            11:09:25,919 INFO [STDOUT] at com.informix.jdbcx.IfxXAResource.commit(IfxXAResource.java:86)
            11:09:25,919 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.commit(XAManagedConnection.java:176)
            11:09:25,919 INFO [STDOUT] at com.arjuna.ats.internal.jta.resources.jts.orbspecific.XAResourceRecord.commit_one_phase(XAResourceRecord.java:691)
            11:09:25,919 INFO [STDOUT] at com.arjuna.ArjunaOTS.OTSAbstractRecordPOA._invoke(OTSAbstractRecordPOA.java:61)
            11:09:25,919 INFO [STDOUT] at org.jacorb.poa.RequestProcessor.invokeOperation(Unknown Source)
            11:09:25,919 INFO [STDOUT] at org.jacorb.poa.RequestProcessor.process(Unknown Source)
            11:09:25,919 INFO [STDOUT] at org.jacorb.poa.RequestProcessor.run(Unknown Source)

            • 3. Re: Using oracle thin and OCI driver in transactions fails
              marklittle

              Unfortunately informix isn't one of our supported platforms for JBossTS 4.2.

              • 4. Re: Using oracle thin and OCI driver in transactions fails
                marklittle

                If you go back to pure Oracle, what happens if you use the OCI driver at both server1 and server2?

                • 5. Re: Using oracle thin and OCI driver in transactions fails
                  marklittle

                  As far as the debugger is concerned, the places to look would be in the XAResourceRecord class. When commit is called (presumably by the client in server1), it should instruct the XAResourceRecord instances in server1 and server2 to go through prepare and then (assuming prepare is successful on both) commit. It looks like on server2 it goes to rollback, but we can't see from this trace whether prepare was called initially. If it wasn't then that's one place to look for possible issues. If it was, then we need to know why prepare failed (presumably on the XAResourceRecord in server2).

                  • 6. Re: Using oracle thin and OCI driver in transactions fails
                    moisesjboss

                    I have found a workaround for the OCI driver. The driver does not like the global and branch qualifier IDs if they are not padded to 64 bytes. I have modified the methods XidImple.getGlobalTransactionId() and XidImple.getBranchQualifier() to return a padded array of 64 bytes.

                    I don't know if it is a bug in the JDBC driver or in the Transaction manager. I was hopping that Informix was going to work (since they show the same error) but it failed as before.

                    The messages below are shown in server2 (where Informix is called) when the error occurs. Could you tell me where they are? I could not find them in the source code:

                    13:38:15,983 WARN [controller] rid: 10 opname: _is_a cannot process request, be cause object doesn't exist
                    13:38:15,983 WARN [controller] rid: 10 opname: _is_a request rejected with exception:
                    13:38:15,983 WARN [controller] rid: 8 opname: rollback cannot process request,because object doesn't exist
                    13:38:15,983 WARN [controller] rid: 8 opname: rollback request rejected with exception:

                    • 7. Re: Using oracle thin and OCI driver in transactions fails
                      marklittle

                       

                      "moisesjboss" wrote:
                      I have found a workaround for the OCI driver. The driver does not like the global and branch qualifier IDs if they are not padded to 64 bytes. I have modified the methods XidImple.getGlobalTransactionId() and XidImple.getBranchQualifier() to return a padded array of 64 bytes.

                      I don't know if it is a bug in the JDBC driver or in the Transaction manager.


                      Good to know, thanks. I've added a JIRA issue so you can track this in the official release cycle (http://jira.jboss.com/jira/browse/JBTM-98)


                      I was hopping that Informix was going to work (since they show the same error) but it failed as before.

                      The messages below are shown in server2 (where Informix is called) when the error occurs. Could you tell me where they are? I could not find them in the source code:

                      13:38:15,983 WARN [controller] rid: 10 opname: _is_a cannot process request, be cause object doesn't exist
                      13:38:15,983 WARN [controller] rid: 10 opname: _is_a request rejected with exception:
                      13:38:15,983 WARN [controller] rid: 8 opname: rollback cannot process request,because object doesn't exist
                      13:38:15,983 WARN [controller] rid: 8 opname: rollback request rejected with exception:


                      These come from the ORB (JacORB in this case). They would appear to indicate that the coordinator has called rollback on the OTS::Resource instance (since you're using the JTS implementation of JTA) and the remote instance is no longer available. It looks like it has already been garbage collected by the system and unregistered from the ORB.

                      The best place to look would be to determine why rollback is being called from the coordinator in the first place.

                      • 8. Re: Using oracle thin and OCI driver in transactions fails
                        marklittle

                        BTW, apparently if you use the Oracle 10g OCI driver this problem should vanish (with a 9i database if you cannot migrate that). I haven't had a chance to confirm this yet, but you may want to give it a try.

                        • 9. Re: Using oracle thin and OCI driver in transactions fails
                          moisesjboss

                          I am using oracle 10g (server and driver). I have not tried oracle 9i. By the way the oracle 10g thin driver does not show the problem.

                          The informix issue: PREPARE_NOTOK is returned from the prepare method:

                          BasicAction.prepare()
                          BasicAction.doPrepare()
                          BasicAction.doPrepare()
                          ExtendedResourceRecord.topLevelPrepare() in turn calls _resourceHandle.prepare.value(). This method returns Vote._VoteRollback.

                          _resourceHandle is the class ArjunaSubtranAwareResource, and I could not find in the source code for it. Is the class auto-generated?

                          Thanks a lot for the help.

                          • 10. Re: Using oracle thin and OCI driver in transactions fails
                            marklittle

                            Yes, ArjunaSubtranAwareResource appears in the ArjunaOTS.idl file and the various stubs are created by the IDL compiler.

                            Is it possible to attach a debugger to the process where this instance resides?

                            • 11. Re: Using oracle thin and OCI driver in transactions fails
                              keving_atl

                               

                              "mark.little@jboss.com" wrote:
                              Unfortunately informix isn't one of our supported platforms for JBossTS 4.2.


                              We are interested in implementing JBossTS. We have two XA resources, one of which is Informix. I see you noted that Informix is not supported for JBossTS 4.2. Can you confirm whether you meant 'not supported' (ie you aren't going to answer informix related questions here) OR can you can confirm that the 2 are not interoperable? Also, did you mean the Informix DB as a whole or just the Infx JDBC driver's?

                              If we were to use the JDBC driver that comes with JBossTS; do you have any knowledge of whether or not it is interoperable with Informix?

                              Thanks,



                              • 12. Re: Using oracle thin and OCI driver in transactions fails
                                marklittle

                                We don't test against Informix (and never have) and as a result is has not been through the thousands of QA and unit tests we've got. If you want to try to get the system to run against Informix then we can obviously give best-effort help through the forum, but since we don't have Informix set up here it'll be limited.

                                • 13. Re: Using oracle thin and OCI driver in transactions fails
                                  moisesjboss

                                  I finally got an answer from Informix support regarding a trace file I sent them. The prepare step fails during the 2PC. Here is the comment:


                                  Looking at the traces I see

                                  C->S (152) Time: 2006-07-24 22:58:25.13000
                                  SQ_XEND

                                  Format:131072

                                  LGTRID:64

                                  LBQUAL:64
                                  ================================================================================
                                  HEX DUMP:
                                  0: 31 2d 61 36 38 30 31 37 61 3a 38 37 61 3a 34 34 1-a68017a:87a:44
                                  0x10: 63 35 34 66 39 35 3a 35 35 66 00 00 00 00 00 00 c54f95:55f......
                                  0x20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
                                  0x30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
                                  0x40: 61 36 38 30 31 39 35 3a 39 30 36 3a 34 34 63 35 a680195:906:44c5
                                  0x50: 39 36 38 64 3a 37 66 00 00 00 00 00 00 00 00 00 968d:7f.........
                                  0x60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
                                  0x70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

                                  ================================================================================

                                  RMID: 1

                                  Flags: 33554432 ( TMSUSPEND )
                                  SQ_EOT

                                  S->C (6) Time: 2006-07-24 22:58:25.14600
                                  SQ_XERR

                                  In your case what is happening is that JBOSS is telling the server to suspend the transaction rather than
                                  end the transaction. So when a prepare message is sent to the server the server cannot prepare because
                                  the transaction is suspended. And it responds with error -6.
                                  The XA_END needs to be called with TMSUCCESS flag.


                                  Using the debugger I can see that TsansactionImple.delistResource() does pass TMSUSPEND to xaRes.end(info.xid(), XAResource.TMSUSPEND) on line 951.
                                  A few lines before the condition ((flags & XAResource.TMSUCCESS) != 0) fails, which I think should have succeeded. Can you comment on this.

                                  Here is a sample code that throws the exception during the prepare method when passing TMSUSPEND to XAResource.end() method.

                                  xaRes.start(xid,XAResource.TMNOFLAGS);
                                  ResultSet rs = con.createStatement().executeQuery("select * from systables");
                                  xaRes.end(xid, XAResource.TMSUSPEND);
                                  int prep = xaRes.prepare(xid);

                                  This is the exception thrown by Informix driver:
                                  XAError Code: -6
                                  javax.transaction.xa.XAException
                                  at com.informix.jdbcx.IfxXAResource.prepare(IfxXAResource.java:275)
                                  at xams.TestInformixJDBCDriver.testXA(TestInformixJDBCDriver.java:67)
                                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


                                  • 14. Re: Using oracle thin and OCI driver in transactions fails
                                    marklittle

                                     

                                    "moisesjboss" wrote:
                                    Using the debugger I can see that TsansactionImple.delistResource() does pass TMSUSPEND to xaRes.end(info.xid(), XAResource.TMSUSPEND) on line 951.


                                    If you mean
                                    if ((flags & XAResource.TMSUSPEND) != 0)
                                    {
                                     xaRes.end(info.xid(), XAResource.TMSUSPEND);
                                     info.setState(TxInfo.ASSOCIATION_SUSPENDED);
                                    


                                    then it does this because that is the flag (or a component of it) that is passed in to delistResource.


                                    A few lines before the condition ((flags & XAResource.TMSUCCESS) != 0) fails, which I think should have succeeded. Can you comment on this.


                                    All those tests are doing is checking the content of the flags that are passed in to delistResource. The one above simply says: "if TMSUCCESS is a component of flags then do this else ..."


                                    Here is a sample code that throws the exception during the prepare method when passing TMSUSPEND to XAResource.end() method.

                                    xaRes.start(xid,XAResource.TMNOFLAGS);
                                    ResultSet rs = con.createStatement().executeQuery("select * from systables");
                                    xaRes.end(xid, XAResource.TMSUSPEND);
                                    int prep = xaRes.prepare(xid);

                                    This is the exception thrown by Informix driver:
                                    XAError Code: -6
                                    javax.transaction.xa.XAException
                                    at com.informix.jdbcx.IfxXAResource.prepare(IfxXAResource.java:275)
                                    at xams.TestInformixJDBCDriver.testXA(TestInformixJDBCDriver.java:67)
                                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


                                    However, if you check XAResource, you'll see ...

                                    if (endAssociation())
                                    {
                                     _theXAResource.end(_tranID, XAResource.TMSUCCESS);
                                    }
                                    
                                    if (_theXAResource.prepare(_tranID) == XAResource.XA_RDONLY)
                                    


                                    which if you cross reference back to TransactionImple, goes something like this: assuming TMSUSPEND was passed in to delistResource, then the state of the resource as far as the transaction system is concerned would be in TxInfo.ASSOCIATION_SUSPENDED. During prepare, the endAssociation method checks this state, and if it isn't TxInfo.NOT_ASSOCIATED then it's supposed to force an explicit end. However, after checking the code iappear that there may be a logic error in the TS code. If I'm right, it also means that Oracle and SQLServer "play nice" (aka non-standard) in this case.

                                    If you are prepared to try some code changes in TS to see if I'm right, let me know. Alternatively we could try to get you a modified jar to try, but it may take a while due to other work commitments.

                                    1 2 Previous Next