6 Replies Latest reply on Nov 2, 2005 12:10 PM by Mike Darretta

    Intermittent TransactionRollbackLocalExceptions

    Mike Darretta Newbie

      I inherited my first EJB project. The specs are:

      JBoss 3.2.5
      Struts --> SessionBean --> EntityBean (CMP)
      Postgres 7.3.6
      Redhat Linux ES 3.0

      On rare occassions, I am seeing intermittent "TransactionRollbackLocalExceptions":

      -------------

      javax.ejb.TransactionRolledbackLocalException?: Transaction marked for rollback, possibly a timeout; CausedByException? is:

      Transaction marked for rollback, possibly a timeout: javax.ejb.TransactionRolledbackLocalException?: Transaction marked for rollback, possibly a timeout; CausedByException? is: Transaction marked for rollback, possibly a timeout at sun.reflect.NativeConstructorAccessorImpl?.newInstance0(Native Method) at ....

      ------------

      Though I have not been able to profile each occurrence, at least in this case I was trying to update multiple rows in a single table. The exception occurs almost immediately after making the remote call. If I simply let the system run idle for 10 or so minutes, the problem disappears !!!

      From what I've been able to muster, this is probably an issue with the "findByPrimaryKey" method. I have found many similar issues on the web, but no answers that can address my problem.

      I'm sure I need to provide more information, but I'm not up enough on EJBs to know where to start. Any help is greatly appreciated.

      Regards,
      Mike

        • 2. Re: Intermittent TransactionRollbackLocalExceptions
          Mike Darretta Newbie

          Sorry for the long delay in my reply.

          Here is the stack trace:

          15:54:26,636 ERROR [BeanLock] Saw rolled back tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=moonrock.metnet.navy.mil//10, BranchQual=]
          15:54:26,636 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.lang.Object mil.navy.ia.nicweb.dos.ejb.entity.PorRequestLocal.createValueObject(), causedBy:
          java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
          at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(QueuedPessimisticEJBLock.java:228)
          at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPessimisticEJBLock.java:183)
          at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:85)
          at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54)
          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.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
          at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:484)
          at org.jboss.ejb.Container.invoke(Container.java:723)
          at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:359)
          at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
          at $Proxy258.createValueObject(Unknown Source)
          at mil.navy.ia.nicweb.dos.ejb.session.PorFacadeBean.createPorRequest(PorFacadeBean.java:545)
          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.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.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
          at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
          at org.jboss.ejb.Container.invoke(Container.java:723)
          at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:359)
          at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:83)
          at $Proxy303.createPorRequest(Unknown Source)
          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.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402)
          at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:309)
          at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333)
          at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
          at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
          at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
          at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
          at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
          at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
          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.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)

          • 3. Re: Intermittent TransactionRollbackLocalExceptions
            Mike Darretta Newbie

            Problem was resolved. There was business logic that was causing multiple beans to share a single ID.

            • 4. Re: Intermittent TransactionRollbackLocalExceptions
              dragon_jdh Newbie

               

              multiple beans to share a single ID


              How did you do that?
              would you please explain it in detail?

              Boz I have ever met that exception intermittently.

              thanks

              Regards

              • 5. Re: Intermittent TransactionRollbackLocalExceptions
                tony tony Newbie

                 

                "darretta" wrote:
                Problem was resolved. There was business logic that was causing multiple beans to share a single ID.


                ???????can you speak detail??

                • 6. Re: Intermittent TransactionRollbackLocalExceptions
                  Mike Darretta Newbie

                  Sorry for the late response, dragon_jdh. I have not been monitoring this list....

                  There is nothing magical about the resolution. Essentially, we create beans that represent a user request to add or delete an entity in the system. If an administrator approves the add/delete, then the actual entity bean is created/removed as requested. In the business logic, I was allowing user to request multiple delete requests for the same bean. If the admin user tried to approve all requests in batch mode, the system was not robust enough to handle the duplicate requests.

                  For whatever it's worth, we have some session beans that wrap direct JDBC calls for lookup requests only. (This improved performance 10-fold in some cases.) To prevent transaction rollback exceptions for these methods, we set the @ejb:transaction type="Not Supported". Since the methods are read-only, transactionalization is not important.