2 Replies Latest reply on Dec 19, 2008 6:17 AM by Ross Nicholson

    JBoss Transactions in AS5.0.0.GA

    Ross Nicholson Apprentice

      We recently moved from JBoss AS 4.0.5.GA to AS 5.0.0.GA and have begun testing our applications. The first problem I'm having is to do with transactions. In 4.0.5.GA there are no issues, but in the new version I'm getting the following exception:

      java.lang.IllegalStateException: Can't lock a TransactionLocal after the Transaction has ended


      followed by the following:

      2008-12-18 13:22:34,505 ERROR [org.jboss.web.tomcat.service.jca.CachedConnectionValve] (http-0.0.0.0-8080-2) Application error: action did not complete its transaction suspended tx=TransactionImple < ac, BasicAction: 7f000001:e47f:49491afc:a32 status: ActionStatus.COMMITTED >


      If I try to start another transaction after these errors I get a null pointer exception. The transaction completes successfully on all DB's. Has something changed drastically between the 2 AS releases? Any help would be greatly appreciated.

      Code is like this:

       TransactionManager transactionManager = TransactionManagerLocator.getInstance().locate();
       Transaction transaction = null;
      
       try
       {
       //Begin the transaction and then get the transaction...
       transactionManager.begin();
       transaction = transactionManager.getTransaction();
      
       //Update on DB1
       //Update on DB2
       //Update on DB3
      
       transaction.commit();
       }
       catch(Exception e)
       {
       try
       {
       transaction.rollback();
       }
       catch (SystemException se)
       {
       log.debug(se);
       }
      
       }
       finally
       {
       try
       {
       //close all resources
       }
       catch(SQLException se)
       {
       log.error("SQLException: "+ se);
       }
       }
      
      


      Stack trace as follows:

      2008-12-18 13:22:32,437 DEBUG [org.jboss.resource.connectionmanager.CachedConnectionManager] (http-0.0.0.0-8080-2) Unable to synchronize with transaction
      java.lang.IllegalStateException: Can't lock a TransactionLocal after the Transaction has ended
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.lock(BaseTransactionManagerDelegate.java:226)
       at org.jboss.tm.TransactionLocal.lock(TransactionLocal.java:109)
       at org.jboss.resource.connectionmanager.TransactionSynchronizer.lock(TransactionSynchronizer.java:222)
       at org.jboss.resource.connectionmanager.CachedConnectionManager.getCloseConnectionSynchronization(CachedConnectionManager.java:545)
       at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.java:303)
       at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:720)
       at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:362)
       at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:155)
       at com.paddypower.shopwallet.db.MultipleDatabaseDAO.performTransaction(MultipleDatabaseDAO.java:286)
       at com.paddypower.shopwallet.action.WalletLDAction.performTransaction(WalletLDAction.java:589)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:266)
       at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:167)
       at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:143)
       at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
       at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
       at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
       at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
       at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
       at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
       at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
       at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      2008-12-18 13:22:32,438 DEBUG [org.jboss.resource.connectionmanager.CachedConnectionManager] (http-0.0.0.0-8080-2) Unable to synchronize with transaction
      java.lang.IllegalStateException: Can't lock a TransactionLocal after the Transaction has ended
       at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.lock(BaseTransactionManagerDelegate.java:226)
       at org.jboss.tm.TransactionLocal.lock(TransactionLocal.java:109)
       at org.jboss.resource.connectionmanager.TransactionSynchronizer.lock(TransactionSynchronizer.java:222)
       at org.jboss.resource.connectionmanager.CachedConnectionManager.getCloseConnectionSynchronization(CachedConnectionManager.java:545)
       at org.jboss.resource.connectionmanager.CachedConnectionManager.unregisterConnection(CachedConnectionManager.java:303)
       at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.connectionClosed(TxConnectionManager.java:720)
       at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:362)
       at org.jboss.resource.adapter.jdbc.WrappedConnection.close(WrappedConnection.java:155)
       at com.paddypower.shopwallet.db.MultipleDatabaseDAO.performTransaction(MultipleDatabaseDAO.java:287)
       at com.paddypower.shopwallet.action.WalletLDAction.performTransaction(WalletLDAction.java:589)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:266)
       at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:167)
       at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:143)
       at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
       at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
       at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
       at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
       at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
       at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
       at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
       at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
       at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      2008-12-18 13:22:32,468 DEBUG [org.jboss.web.tomcat.service.jasper.TagLibCache] (http-0.0.0.0-8080-2) Scanning for tlds in: vfsfile:/opt/jboss-5.0.0.GA/server/default/deploy/jbossweb.sar/jsf-libs/jsf-impl.jar
      2008-12-18 13:22:32,687 DEBUG [org.jboss.web.tomcat.service.jasper.TagLibCache] (http-0.0.0.0-8080-2) Scanning for tlds in: vfsfile:/opt/jboss-5.0.0.GA/server/default/deploy/jbossweb.sar/jstl.jar
      2008-12-18 13:22:34,505 ERROR [org.jboss.web.tomcat.service.jca.CachedConnectionValve] (http-0.0.0.0-8080-2) Application error: action did not complete its transaction suspended tx=TransactionImple < ac, BasicAction: 7f000001:e47f:49491afc:a32 status: ActionStatus.COMMITTED >