title: Occasional 'EJBTransactionRolledbackException: Transaction rolled back' errors hanging the application
body: <p>Application is hosted in JBoss6 (version 6.0.0.Final).</p>
  
  <p>In production environment I see sometimes the following errors:</p>
  
  <pre><code>2012-10-01 17:59:00,290 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-9) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:115) [:0.0.1]
  at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:87) [:0.0.1]
  at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:255) [:0.0.1]
  at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:349) [:0.0.1]
  at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1]
  at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) [:1.0.0.GA]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:182) [:1.7.17]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) [:1.7.17]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) [:1.7.17]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.7.17]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) [:1.7.17]
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]
  at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:272) [:1.7.17]
  at org.jboss.ejb3.stateless.StatelessContainer.invokeEndpoint(StatelessContainer.java:617) [:1.7.17]
  at org.jboss.webservices.integration.invocation.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:137) [:6.0.0.Final]
  at org.jboss.wsf.stack.cxf.AbstractInvoker._invokeInternal(AbstractInvoker.java:164) [:3.4.1.GA]
  at org.jboss.wsf.stack.cxf.AbstractInvoker.invoke(AbstractInvoker.java:112) [:3.4.1.GA]
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) [:2.3.1]
  at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [:1.6.0_23]
  at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [:1.6.0_23]
  at java.util.concurrent.FutureTask.run(Unknown Source) [:1.6.0_23]
  at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) [:2.3.1]
  at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) [:2.3.1]
  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) [:2.3.1]
  at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113) [:2.3.1]
  at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97) [:2.3.1]
  at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:461) [:2.3.1]
  at org.jboss.wsf.stack.cxf.ServletControllerExt.invoke(ServletControllerExt.java:172) [:3.4.1.GA]
  at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:57) [:3.4.1.GA]
  at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:156) [:3.4.1.GA]
  at org.jboss.wsf.stack.cxf.CXFNonSpringServletExt.invoke(CXFNonSpringServletExt.java:90) [:3.4.1.GA]
  at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179) [:2.3.1]
  at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103) [:2.3.1]
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [:1.0.0.Final]
  at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159) [:2.3.1]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
  at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67) [:6.0.0.Final]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [:6.0.0.Final]
  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
  at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]
  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]
  at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]
  at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:893) [:6.0.0.Final]
  at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600) [:6.0.0.Final]
  at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2019) [:6.0.0.Final]
  at java.lang.Thread.run(Unknown Source) [:1.6.0_23]
  Caused by: javax.transaction.RollbackException: ARJUNA-16063 The transaction is not active!
  at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1148) [:6.0.0.Final]
  at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119) [:6.0.0.Final]
  at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75) [:6.0.0.Final]
  at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:82) [:0.0.1]
  ... 65 more
  </code></pre>
  
  <p>It happens occasionally about once a week, and number of such exceptions is raising next minutes after first occasion, making entire application hang. After appserver restart, application works normally.</p>
  
  <p>Until restart, there are 242 same errors in the log:</p>
  
  <pre><code>Line 18231: 2012-10-01 17:19:24,290 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-12) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 18404: 2012-10-01 17:19:34,009 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-3) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 18559: 2012-10-01 17:19:24,728 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-7) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 19222: 2012-10-01 17:20:14,728 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-11) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 20212: 2012-10-01 17:27:22,900 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-14) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 20606: 2012-10-01 17:27:32,853 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-16) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 21258: 2012-10-01 17:28:18,540 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-21) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 21361: 2012-10-01 17:28:39,353 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-17) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 21618: 2012-10-01 17:28:39,743 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-12) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 21693: 2012-10-01 17:28:39,884 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-10) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 22428: 2012-10-01 17:38:20,509 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-2) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 23606: 2012-10-01 17:38:51,790 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-35) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 23987: 2012-10-01 17:38:42,181 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-11) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 24378: 2012-10-01 17:39:02,259 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-14) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 24625: 2012-10-01 17:39:12,306 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-50) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 25032: 2012-10-01 17:39:24,947 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-17) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 25191: 2012-10-01 17:39:34,634 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-25) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 25610: 2012-10-01 17:39:34,853 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-40) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 25690: 2012-10-01 17:39:35,009 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-23) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 25932: 2012-10-01 17:39:35,165 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-35) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 26013: 2012-10-01 17:39:45,165 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-49) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 26170: 2012-10-01 17:39:45,243 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-42) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 26331: 2012-10-01 17:39:56,712 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-81-14) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  Line 26651: 2012-10-01 17:40:08,243 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-18) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  ....other hundreds of errors...
  Line 64132: 2012-10-01 18:19:01,712 ERROR [org.jboss.webservices.integration.invocation.InvocationHandlerEJB3] (http-ntpen1.company.name%2F80.95.224.149-444-15) Method invocation failed with exception: Transaction rolled back: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
  </code></pre>
  
  <p>Before each error there are the following entries in the log:</p>
  
  <pre><code>Line 18188: 2012-10-01 17:17:38,837 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffff505fe095:1274:505afcea:577d43 in state  RUN
  Line 18189: 2012-10-01 17:17:38,868 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA-12095 Abort of action id 0:ffff505fe095:1274:505afcea:577d43 invoked while multiple threads active within it.
  Line 18190: 2012-10-01 17:17:38,868 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA-12108 CheckedAction::check - atomic action 0:ffff505fe095:1274:505afcea:577d43 aborting with 1 threads active!
  Line 18191: 2012-10-01 17:17:59,087 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffff505fe095:1274:505afcea:577d43 in state  CANCEL
  Line 18229: 2012-10-01 17:19:24,290 WARN  [com.arjuna.ats.arjuna] (http-ntpen1.company.name%2F80.95.224.149-81-12) ARJUNA-12077 Abort called on already aborted atomic action 0:ffff505fe095:1274:505afcea:577d43
  </code></pre>
  
  <p>Application itself is set of SOAP web-services and dynamic JSF/Richfaces web pages.
  Most of the logic is located in stateless beans (@Stateless).</p>
  
  <p>My guess is that sometimes calls to web-service take too much time, causing EJBTransactionRolledbackException. The question is why sometimes it hangs entire application? Plus the exception stacktrace doesn't contain calls in application code.</p>
  
  <p>Can it be because of running out of pool (stateless bean objects pool)?</p>