3 Replies Latest reply on May 6, 2004 5:48 AM by pepcodina

    org.jboss.tm.JBossTransactionRolledbackException when access

    pepcodina

      Hi,

      I've got an Oracle xa datasource configured in my application. The datasource configuration file looks like this:

      <datasources>
       <xa-datasource>
       <jndi-name>jdbc/myDataSource</jndi-name>
       <track-connection-by-tx>true</track-connection-by-tx>
       <isSameRM-override-value>false</isSameRM-override-value>
       <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
       <xa-datasource-property name="URL">jdbc:oracle:thin:@hostname:1521:systao</xa-datasource-property>
       <xa-datasource-property name="User">user</xa-datasource-property>
       <xa-datasource-property name="Password">password</xa-datasource-property>
       <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
       <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
       <!-- Checks the Oracle error codes and messages for fatal errors -->
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
       <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global transaction and vice-versa -->
       <no-tx-separate-pools/>
       </xa-datasource>
      
       <mbean code="org.jboss.resource.adapter.jdbc.xa.oracle.OracleXAExceptionFormatter"
       name="jboss.jca:service=OracleXAExceptionFormatter">
       <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
       </mbean>
      
      </datasources>
      



      I've successfully deployed this datasource in my jboss 3.2.3 installation in a W2k box. Everything works. Nevertheless, If i deploy the application to a jboss3.2.3 in a Linux box the datasource is correctly deployed, the application is correctly deployed, but when I access an EJB (from a Servlet) I get the following Exception:

      org.jboss.tm.JBossTransactionRolledbackException: null; nested exception is:
       org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (oracle.jdbc.xa.OracleXAException); - nested throwable: (org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (oracle.jdbc.xa.OracleXAException))
       at org.jboss.ejb.plugins.TxInterceptorCMT.throwJBossException(TxInterceptorCMT.java:489)
       at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:403)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
       at org.jboss.ejb.Container.invoke(Container.java:700)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      


      Could anyone give me some light of what is it happening?

      Thanks in advance.

      P.



        • 1. Re: org.jboss.tm.JBossTransactionRolledbackException when ac

          This is a generic error from Oracle saying it does not like the commit,
          look for error messages before this one
          or failing that turn on TRACE logging (explained in READ THIS FIRST).
          You might also want to look at the Oracle log.

          • 2. Re: org.jboss.tm.JBossTransactionRolledbackException when ac
            pepcodina

            I am using an Oracle jdbc 8.1.7, but I also tried with a jdbc driver 9.0.2 and I got the same result. I am using exactly the same driver in both Linux and Windows installations and I am accessing to the same database. It is strange that it works for Windows and it doesn't for Linux. I also use the same driver for a WebSphere port of my application and it works in both Linux and Windows.

            I suspect i configured something wrong in Linux, but I can't figure out what since the only datasource related configuration I did in Windows was the datasource.

            I also looked at the embedded exception trace and I found that:


            2004-05-06 11:02:52,992 WARN [org.jboss.tm.TransactionImpl] xa error: -4 (The XID is not valid.); oracle error: 24756; oracle sql error: 0;
            oracle.jdbc.xa.OracleXAException
             at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
             at oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:450)
             at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:156)
             at org.jboss.tm.TransactionImpl.endResource(TransactionImpl.java:1205)
             at org.jboss.tm.TransactionImpl.endResources(TransactionImpl.java:1278)
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:355)
             at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
             at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
             at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
             at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
             at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
             at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
             at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
             at org.jboss.ejb.Container.invoke(Container.java:700)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:324)
             at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
             at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
             at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
             at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
             at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
             at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
             at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
             at $Proxy196.loadOwnUser(Unknown Source)
             at com.nte.anthema.presentation.AnthemaController.setAttributes(AnthemaController.java:70)
             at com.nte.anthema.framework.presentation.Controller.doTask(Controller.java:87)
             at com.nte.anthema.framework.presentation.Controller.doGet(Controller.java:75)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
             at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
             at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
             at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:553)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
             at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
             at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
             at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
             at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
             at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
             at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
             at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
             at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
             at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
             at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
             at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
             at java.lang.Thread.run(Thread.java:534)
            



            I also enabled the traces for the Transaction Manager and I get the following output:

            2004-05-06 11:02:52,474 TRACE [org.jboss.tm.TransactionImpl] enlistResource(): Entered, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=] status=STATUS_ACTIVE
            2004-05-06 11:02:52,474 TRACE [org.jboss.tm.TransactionImpl] startResource(XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=1]) entered: org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@333b2e flags=0
            2004-05-06 11:02:52,887 TRACE [org.jboss.tm.TransactionImpl] startResource(XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=1]) leaving: org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@333b2e flags=0
            2004-05-06 11:02:52,887 TRACE [org.jboss.tm.TransactionImpl] registerSynchronization(): Entered, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=] status=STATUS_ACTIVE
            2004-05-06 11:02:52,892 DEBUG [com.nte.anthema.framework.persistence.Persistor] Got connection for dev_anthema
            2004-05-06 11:02:52,942 TRACE [org.jboss.tm.TxManager] suspended tx: TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=]
            2004-05-06 11:02:52,942 TRACE [org.jboss.tm.TxManager] resumed tx: TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=]
            2004-05-06 11:02:52,942 TRACE [org.jboss.tm.TransactionImpl] Committing, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=], status=STATUS_ACTIVE
            2004-05-06 11:02:52,943 TRACE [org.jboss.tm.TransactionImpl] calling sync 0, org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TxRemover@b05cd7
            2004-05-06 11:02:52,943 TRACE [org.jboss.tm.TransactionImpl] Before completion done, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=], status=STATUS_ACTIVE
            2004-05-06 11:02:52,943 TRACE [org.jboss.tm.TransactionImpl] endresources(0): state=1
            2004-05-06 11:02:52,943 TRACE [org.jboss.tm.TransactionImpl] endResource(XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=1]) entered: org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@333b2e flag=67108864
            2004-05-06 11:02:52,972 TRACE [org.jboss.tm.TransactionImpl] endResource(XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=1]) leaving: org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@333b2e flag=67108864
            2004-05-06 11:02:52,972 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=basictest.e-mm.com//21, BranchQual=] errorCode=XAER_NOTA
            oracle.jdbc.xa.OracleXAException
             at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
             at oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:450)
             at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:156)
             at org.jboss.tm.TransactionImpl.endResource(TransactionImpl.java:1205)
            


            Later on I see the following output:

            2004-05-06 11:02:52,992 WARN [org.jboss.tm.TransactionImpl] xa error: -4 (The XID is not valid.); oracle error: 24756; oracle sql error: 0;
            oracle.jdbc.xa.OracleXAException
             at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
             at oracle.jdbc.xa.client.OracleXAResource.end(OracleXAResource.java:450)
             at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:156)
            


            I've searched information about this error code, but I couldn'd find anything.

            P.

            • 3. Re: org.jboss.tm.JBossTransactionRolledbackException when ac
              pepcodina

              Aaaaaaaggg!

              I found the problem. I missed to uncomment the line

              <attribute name="Pad">true</attribute>
              


              to make the XidFactory compatible with Oracle.

              Problem fixed!

              P.