2 Replies Latest reply on Mar 11, 2005 3:10 PM by Adrian Brock

    BMT + nested transactions

    Robson Newbie

      Hi,

      I'm using here a combination of BMT MDB + Spring JTA Tx manager + Hibernate.

      JBoss 4.0.1SP1, JDK 1.5.0_01, Windows platform.


      Inside my BMT, i do this:

      --> Start/commit tx A (propagation mode REQUIRED)

      --> Do heavy work in other TX (propagation mode REQUIRED)

      --> Start/commit tx B (propagation mode REQUIRED)

      I do these thinks in 3 separated transactions because I need to do mark, in the database, the date/time the work started and finished, independently of the result of the work in the middle. Also the tx A must be commited before the work begins.

      Howver, sometimes I need to fetch some data from database during the lengthy work, and, to do this, I try to open a new transaction (propagation mode REQUIRES_NEW). However, I'm getting the following WARN, and the exception:
      21:43:36,453 WARN [TxConnectionManager] in Enlisting tx, trying to change tx. illegal state: old: TransactionImpl:XidImpl[FormatId=257, GlobalId=lobato/169, BranchQual=, localId=169], new: TransactionImpl:XidImpl[FormatId=257, GlobalId=lobato/170, BranchQual=, localId=170], cel: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1577f8b[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@18f11d3 handles=1 lastUse=1110490820062 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@11c3b04 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@66b56b]
      21:43:36,468 ERROR [JtaTransactionManager] Rollback exception overridden by synchronization exception
      java.lang.IllegalStateException: Transaction synchronization is not active
      at org.springframework.transaction.support.TransactionSynchronizationManager.getSynchronizations(TransactionSynchronizationManager.java:235)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCompletion(AbstractPlatformTransactionManager.java:540)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:451)
      at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:141)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:118)
      at org.biofoco.server.process.CleanProjectProcess.execute(CleanProjectProcess.java:59)
      at org.biofoco.server.ejb.mdb.PipelineExecutorBean.onMessage(PipelineExecutorBean.java:85)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
      at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:153)
      at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)
      at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:87)
      at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
      at org.jboss.ejb.Container.invoke(Container.java:870)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:967)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1253)
      at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
      at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
      at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
      at org.jboss.mq.SpySession.run(SpySession.java:351)
      at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      at java.lang.Thread.run(Thread.java:595)
      21:43:36,468 ERROR [TransactionTemplate] Application exception overridden by rollback exception
      java.lang.IllegalStateException: Trying to change Tx in enlist!
      at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:419)
      at org.jboss.resource.connectionmanager.TxConnectionManager.transactionStarted(TxConnectionManager.java:314)
      at org.jboss.resource.connectionmanager.CachedConnectionManager.userTransactionStarted(CachedConnectionManager.java:392)
      at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.begin(ServerVMClientUserTransaction.java:113)
      at org.springframework.transaction.jta.JtaTransactionManager.doBegin(JtaTransactionManager.java:456)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:232)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:111)
      at org.biofoco.server.programs.ExternalProgram.executeProgram(ExternalProgram.java:53)
      at org.biofoco.server.programs.CrossMatchProgram.execute(CrossMatchProgram.java:35)
      at org.biofoco.server.service.CleanPlateService.processPlateFiles(CleanPlateService.java:149)
      at org.biofoco.server.service.CleanPlateService.cleanPlate(CleanPlateService.java:99)
      at org.biofoco.server.process.CleanProjectProcess$1.doInTransaction(CleanProjectProcess.java:74)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:114)
      at org.biofoco.server.process.CleanProjectProcess.execute(CleanProjectProcess.java:59)
      at org.biofoco.server.ejb.mdb.PipelineExecutorBean.onMessage(PipelineExecutorBean.java:85)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
      at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:153)
      at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)
      at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:87)
      at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
      at org.jboss.ejb.Container.invoke(Container.java:870)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:967)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1253)
      at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
      at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
      at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
      at org.jboss.mq.SpySession.run(SpySession.java:351)
      at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      at java.lang.Thread.run(Thread.java:595)
      21:43:36,468 INFO [GenomaLogger] project_cleaning: The process throwed an exception
      java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active
      at org.springframework.transaction.support.TransactionSynchronizationManager.clearSynchronization(TransactionSynchronizationManager.java:248)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:599)
      at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:483)
      at org.springframework.transaction.support.TransactionTemplate.rollbackOnException(TransactionTemplate.java:141)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:118)
      at org.biofoco.server.process.CleanProjectProcess.execute(CleanProjectProcess.java:59)
      at org.biofoco.server.ejb.mdb.PipelineExecutorBean.onMessage(PipelineExecutorBean.java:85)
      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:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:475)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
      at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:153)
      at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)
      at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:87)
      at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:94)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:389)
      at org.jboss.ejb.Container.invoke(Container.java:870)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:967)
      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1253)
      at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
      at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:904)
      at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
      at org.jboss.mq.SpySession.run(SpySession.java:351)
      at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
      at java.lang.Thread.run(Thread.java:595)

      Looking at the code, I noticed that the new transaction was was trying to enlist the database connection that was used in the current transaction. I thought the connection was freed when the first TX commited.

      Thanks for any suggestion
      Robson

        • 1. Re: BMT + nested transactions
          Robson Newbie

          I did some more testing, and found that using the TransactionManager interface works correctly.
          If the UserTransaction is used to begin/commit the transactions and TransactionManager to suspend/resume, the exception occurs.

          The following bean tests the behaviour:

          package org.biofoco.server.ejb.facade;
          
          import java.rmi.RemoteException;
          import java.sql.Connection;
          
          import javax.ejb.EJBException;
          import javax.ejb.SessionBean;
          import javax.ejb.SessionContext;
          
          import javax.ejb.CreateException;
          import javax.naming.InitialContext;
          import javax.sql.DataSource;
          import javax.transaction.Transaction;
          import javax.transaction.TransactionManager;
          
          /**
           * @ejb.bean name="Test" display-name="Name for Test" description="Description
           * for Test" jndi-name="ejb/Test" type="Stateless" view-type="remote"
           * transaction-type = "Bean"
           * @ejb.util generate = "physical"
           */
          public class TestBean implements SessionBean {
          
           private SessionContext ctx;
          
           public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException {
           this.ctx = ctx;
           }
          
           public void ejbRemove() throws EJBException, RemoteException {
           }
          
           public void ejbActivate() throws EJBException, RemoteException {
           }
          
           public void ejbPassivate() throws EJBException, RemoteException {
           }
          
           /**
           * Default create method
           *
           * @throws CreateException
           * @ejb.create-method
           */
           public void ejbCreate() throws CreateException {
           }
          
           /**
           * @ejb.interface-method
           *
           */
           public void transactedMethod(boolean useUserTransaction) {
           try {
           InitialContext ic = new InitialContext();
           TransactionManager tm = (TransactionManager) ic.lookup("java:/TransactionManager");
          
           if (useUserTransaction)
           ctx.getUserTransaction().begin();
           else
           tm.begin();
           DataSource ds = (DataSource) ic.lookup("java:/DefaultDS");
          
           Connection c1 = ds.getConnection();
           Transaction t1 = tm.suspend();
          
           if (useUserTransaction)
           ctx.getUserTransaction().begin();
           else
           tm.begin();
           Connection c2 = ds.getConnection();
           c2.close();
           // Commit t2
           if (useUserTransaction)
           ctx.getUserTransaction().commit();
           else
           tm.commit();
          
           tm.resume(t1);
           c1.close();
          
           // Commit T1
           if (useUserTransaction)
           ctx.getUserTransaction().commit();
           else
           tm.commit();
          
           } catch (Exception e) {
           e.printStackTrace();
           }
           }
          
          }
          


          If it is called with useUserTransaction = false, it works as expected. If userTransaction = true, the exception is:

          23:09:03,234 WARN [TxConnectionManager] in Enlisting tx, trying to change tx. illegal state: old: TransactionImpl:XidImpl[FormatId=257, GlobalId=lobato/28, BranchQual=, localId=28], new: TransactionImpl:XidImpl[FormatId=257, GlobalId=lobato/29, BranchQual=, localId=29], cel: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@13f87b1[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@21a44e handles=1 lastUse=1110496140796 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$PoolBySubject@1b7a261 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@105c9a1]
          23:09:03,234 INFO [STDOUT] java.lang.IllegalStateException: Trying to change Tx in enlist!
          23:09:03,234 INFO [STDOUT] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:419)
          23:09:03,234 INFO [STDOUT] at org.jboss.resource.connectionmanager.TxConnectionManager.transactionStarted(TxConnectionManager.java:314)
          23:09:03,234 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionManager.userTransactionStarted(CachedConnectionManager.java:392)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.EnterpriseContext$UserTransactionImpl.begin(EnterpriseContext.java:568)
          23:09:03,234 INFO [STDOUT] at org.biofoco.server.ejb.facade.TestBean.transactedMethod(TestBean.java:72)
          23:09:03,234 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          23:09:03,234 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          23:09:03,234 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          23:09:03,234 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
          23:09:03,234 INFO [STDOUT] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
          23:09:03,234 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
          23:09:03,234 INFO [STDOUT] at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:153)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
          23:09:03,234 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:870)
          23:09:03,234 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          23:09:03,234 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          23:09:03,234 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          23:09:03,234 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
          23:09:03,234 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
          23:09:03,234 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          23:09:03,234 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
          23:09:03,234 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
          23:09:03,250 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          23:09:03,250 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
          23:09:03,250 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
          23:09:03,250 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:115)
          23:09:03,250 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:101)
          23:09:03,250 INFO [STDOUT] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
          23:09:03,250 INFO [STDOUT] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
          23:09:03,250 INFO [STDOUT] at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
          23:09:03,250 INFO [STDOUT] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
          23:09:03,250 INFO [STDOUT] at $Proxy57.transactedMethod(Unknown Source)
          23:09:03,250 INFO [STDOUT] at org.apache.jsp.test_jsp._jspService(test_jsp.java:50)
          23:09:03,250 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
          23:09:03,250 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          23:09:03,250 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
          23:09:03,250 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          23:09:03,250 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          23:09:03,250 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          23:09:03,250 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
          23:09:03,250 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          23:09:03,265 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          23:09:03,265 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          23:09:03,265 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          23:09:03,265 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
          23:09:03,265 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
          23:09:03,265 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
          23:09:03,265 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
          23:09:03,265 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
          23:09:03,265 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
          23:09:03,265 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
          23:09:03,265 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@1f08e98
          java.lang.Exception: STACKTRACE
          at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:320)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:477)
          at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:838)
          at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
          at org.biofoco.server.ejb.facade.TestBean.transactedMethod(TestBean.java:68)
          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:585)
          at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
          at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
          at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
          at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
          at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:153)
          at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
          at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
          at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
          at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
          at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
          at org.jboss.ejb.Container.invoke(Container.java:870)
          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:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
          at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
          at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:115)
          at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:101)
          at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
          at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
          at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
          at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
          at $Proxy57.transactedMethod(Unknown Source)
          at org.apache.jsp.test_jsp._jspService(test_jsp.java:50)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
          at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
          at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
          at java.lang.Thread.run(Thread.java:595)
          23:09:03,265 ERROR [TxInterceptorBMT] Application error: BMT stateless bean Test should complete transactions before returning (ejb1.1 spec, 11.6.1)
          23:09:03,281 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
          java.rmi.RemoteException: Application error: BMT stateless bean Test should complete transactions before returning (ejb1.1 spec, 11.6.1)
          at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.checkStatelessDone(AbstractTxInterceptorBMT.java:208)
          at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:157)
          at org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
          at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
          at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
          at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
          at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
          at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
          at org.jboss.ejb.Container.invoke(Container.java:870)
          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:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
          at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
          at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
          at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:115)
          at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:101)
          at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
          at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
          at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
          at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:91)
          at $Proxy57.transactedMethod(Unknown Source)
          at org.apache.jsp.test_jsp._jspService(test_jsp.java:50)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
          at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
          at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
          at java.lang.Thread.run(Thread.java:595)


          • 2. Re: BMT + nested transactions
            Adrian Brock Master

            What a mess.

            javax.transaction.Transaction is NOT a user api.
            It is intended for J2EE Server <-> TM integeration.

            If you are going to use it, make sure you read the spec.

            You certainly shouldn't be switching transaction mid ejb method,
            CMT already has this notion it is called RequiresNew.