1 Reply Latest reply on Nov 22, 2004 7:29 AM by pdg

    Bad transaction won't go away

    Tim McCune Novice

      JBoss 3.2.5, JDK 1.4.2, Linux

      I'm seeing an intermittent problem with an EJB where sometimes, on a new remote invocation (tx Required), JBoss gives me an old, invalid transaction. This results in an "Already marked for rollback" exception. I turned on trace debugging, and I notice that every time I get this exception, it's because JBoss has again given me the same invalid transaction.

      2004-11-07 17:00:37,459 TRACE [org.jboss.ejb.plugins.TxInterceptorCMT] Current transaction in MI is TransactionImpl:XidImpl [FormatId=257, GlobalId=panda.ws.hmsonline.com//60322, BranchQual=]

      I reinvoke the EJB method several times, and most of the time it works, but every time it fails, it's because it got transaction 60322. After digging through the code and some of the forums, it appears that somewhere along the way, this transaction wasn't properly disassociated from a thread, so one of the threads in the pool is always going to have this same bad transaction associated with it. It seems very strange to me that when first entering the EJB container by invoking a remote method on an EJB, that JBoss isn't creating a new transaction, and just discarding this old one. Would it ever be a valid use case to have a new remote invocation use a transaction that was already associated with the thread that it gets from the pool?

      Here is a full stack trace:

      com.hmsonline.harvester.control.FlowControlException: Couldn't load summary
      at com.hmsonline.harvester.control.ejb.HistorianBean.getSummary(HistorianBean.java:133)
      at sun.reflect.GeneratedMethodAccessor375.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:120)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.CleanShutdownInterceptor.invoke(CleanShutdownInterceptor.java:264)
      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:723)
      at sun.reflect.GeneratedMethodAccessor273.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:97)
      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:53)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      at $Proxy117.getSummary(Unknown Source)
      at com.hmsonline.harvester.console.controllers.HistoryDetailController.perform(HistoryDetailController.java:27)
      at com.hmsonline.harvester.console.controllers.BaseHistoryController.perform(BaseHistoryController.java:31)
      at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:869)
      at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
      at org.apache.jsp.common.layout.basic_jsp._jspx_meth_tiles_get_3(basic_jsp.java:651)
      at org.apache.jsp.common.layout.basic_jsp._jspService(basic_jsp.java:116)
      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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:589)
      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
      at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
      at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:581)
      at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
      at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
      at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
      at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:881)
      at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
      at org.apache.jsp.history.detail.index_jsp._jspx_meth_tiles_insert_0(index_jsp.java:76)
      at org.apache.jsp.history.detail.index_jsp._jspService(index_jsp.java:52)
      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.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.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
      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:117)
      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:534)
      Caused by: net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
      at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3322)
      at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3286)
      at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
      at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:773)
      at net.sf.hibernate.loader.Loader.doQuery(Loader.java:266)
      at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
      at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:905)
      at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:925)
      at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
      at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
      at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
      at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
      at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1991)
      at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1920)
      at com.hmsonline.harvester.control.ejb.HistorianBean.getSummary(HistorianBean.java:130)
      ... 93 more
      Caused by: javax.transaction.RollbackException: Already marked for rollback
      at org.jboss.tm.TransactionImpl.registerSynchronization(TransactionImpl.java:704)
      at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3317)
      ... 107 more