3 Replies Latest reply on Sep 21, 2011 8:36 AM by Ronaldo Campos

    Seam Synchronizations and EJB Timeout

    Ronaldo Campos Newbie

      I´m having problems to commit a JTA transaction that takes a long time to accomplish. I am executing a stored procedure that takes about 2 hours to execute and when I try to commit my transaction the following exception is throwed:




      javax.ejb.NoSuchEJBException: Could not find stateful bean: 4p7205d-gzn6tl-gsrrjt6f-1-gsrrnzdn-av
           at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:479)
           at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:430)
           at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:59)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
           at org.jboss.aspects.tx.TxInterceptor$Supports.invoke(TxInterceptor.java:147)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
           at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)
           at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)
           at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
           at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
           at $Proxy482.beforeTransactionCommit(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:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
           at org.javassist.tmp.java.lang.Object_$$_javassist_seam_3.beforeTransactionCommit(Object_$$_javassist_seam_3.java)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:49)
           at br.com.technocall.framework.model.dao.TransacaoControladaDAO.confirmaTransacao(TransacaoControladaDAO.java:53)
           at br.coop.castrolanda.fsw.cpj.controle.ProcessoAssincrono.run(ProcessoAssincrono.java:46)
           at java.lang.Thread.run(Thread.java:619)




      Debugging the application (including Seam sources) I found that the exception cames from:




      Synchronizations synchronizations = getSynchronizations();
      synchronizations.beforeTransactionCommit();



      I observed that this error only occurs when the time to execute is longer than the EJB idleTimeoutSeconds (see JBoss configuration ejb3-interceptors-aop.xml). So i assume that the EJB that represents the component org.jboss.seam.transaction.synchronizations is removed during this execution and is no more available on the commit time.


      I don´t want to increase the idleTimeoutSeconds and I cant use @CacheConfig to increase only to this EJB since its a internal Seam EJB.


      Is there a solution to this problem? Or some workaround?


      I am using: Seam 2.2.0.GA on JBossAS 5.1


      Some information:


      In my components.xml:


      <transaction:ejb-transaction />



      The EJB from where the SP is called:


      @Stateful
      @Local(IOperacaoAction.class)
      @Name("OperacaoAction")
      @TransactionAttribute(TransactionAttributeType.REQUIRED)
      @TransactionManagement(TransactionManagementType.BEAN)
      @Scope(ScopeType.CONVERSATION)
      public class OperacaoAction (...)



      The way I get my transaction:


      org.jboss.seam.Transaction.instance()