3 Replies Latest reply on Apr 10, 2008 12:02 PM by Karl Traunmüller

    richfaces ajax request throws 'no concurrent calls on stateful bean'

    Axel Roeber Newbie

      I have a well running application with JBoss 4.0.5, Seam 1.2.1 and RichFaces 3.1.4. But some impatient users are able to create the following exception by clicking several times on a RichFaces Component (in this case a simpleTogglePanel).



      The EJB is defined as


      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("tiaTabsAction")
      @CacheConfig(idleTimeoutSeconds = 
      public class TiaTabsAction implements TiaTabs, Serializable {
      ...
      



      I am reading the documentation at


      http://docs.jboss.org/seam/2.0.1.GA/reference/en/html/conversations.html#d0e5208


      (I know this is 2.0 but to my opinion in this context there is no significant change from Seam 1.2 to 2.0)


      For this application there is no need to make things asynchronous. I would be happy if these requests would just be serialized.


      Adding a


      @Synchronized(timeout=30000)
      @Name("tiaTabsAction")
      



      changes the behaviour (I don't why) in getting a NPE. It seems that it is a new conversation object missing some data. But before 30 seconds are over.


      Playing with the concurrent-request-timeout parameter also doesn't help.


      So what can I do to make the application more robust?


      Axel


      javax.ejb.ConcurrentAccessException: no concurrent calls on stateful bean 'jboss.j2ee:service=EJB3,name=TiaTabsAction' (EJB3 4.3.13)
           at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:73)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
           at $Proxy288.getSecondLevelOtherWorkforceEstimationPerPhase(Unknown Source)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
           at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
           at org.javassist.tmp.java.lang.Object_$$_javassist_77.getSecondLevelOtherWorkforceEstimationPerPhase(Object_$$_javassist_77.java)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
           at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
           at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
           at com.sun.el.parser.AstValue.getValue(Unknown Source)
           at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
           at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
           at javax.faces.component.UIData.getValue(UIData.java:1019)
           at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1459)
           at org.ajax4jsf.component.SequenceDataAdaptor.getDataModel(SequenceDataAdaptor.java:70)
           at org.ajax4jsf.component.SequenceDataAdaptor.createDataModel(SequenceDataAdaptor.java:64)
           at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:592)
           at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:327)
           at org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:968)
           at org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1001)
           at org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1011)
           at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:602)
           at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:602)
           at org.ajax4jsf.component.AjaxViewRoot$1.invoke(AjaxViewRoot.java:256)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:78)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:83)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:83)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:83)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:83)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:83)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:58)
           at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:170)
           at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:276)
           at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
           at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
           at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
           at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Unknown Source)


        • 1. Re: richfaces ajax request throws 'no concurrent calls on stateful bean'
          Marcus Popetz Newbie

          Don't know if you're hitting this with a4j support or not, but have you checked out the eventQueue attribute that's available on the a4j stuff?


          -mp 

          • 2. Re: richfaces ajax request throws 'no concurrent calls on stateful bean'
            Axel Roeber Newbie

            Marcus Popetz wrote on Mar 21, 2008 06:14 PM:


            Don't know if you're hitting this with a4j support or not, but have you checked out the eventQueue attribute that's available on the a4j stuff?

            -mp 


            Yes, the RichFaces simpleTogglePanel has an attribut eventsQueue. Using this attribut in combination with the @Synchronized is the best approach (which I know) to minimize this problem. Perhaps interesting to know: I have tried to use this attribut, but without the 's' in the middle. This is an typing error in the RichFaces user guide where this attribut is explained ('Limitation of requests frequency and updates quantity after the responses'). Also interesting is the different explaination of this flag in the RichFaces docu (where it is describing what happens with the response) and the Seam docu (were the request is mentioned).


            But simulating a very impatient user the error still occurs. I also don't understand whether it seems to be helpful to use the @Synchronized annotation.


            Axel

            • 3. Re: richfaces ajax request throws 'no concurrent calls on stateful bean'
              Karl Traunmüller Newbie

              We're observing the same problem in our application when putting it under heavy load.


              In our case this is pretty nasty, since we're trying to free up resources (sessions of a native runtime integrated via JNI) in the @Destroy method. Due to the concurrent access exception (thrown by the EJB container, I suppose), the resources don't always get freed, leading to other problems in succession.


              I guess we will have to resort to finalizers for guaranteed resource deallocation.


              (JBoss 4.2.2.GA, Seam 2.0.1.GA, RichFaces 3.1.4.GA, application non-clustered, Selenium RC driving the tests)


              2008-04-10 11:42:51,965 WARN  [org.jboss.seam.Component] Exception calling component @Destroy method: berechnung
              javax.ejb.ConcurrentAccessException: no concurrent calls on stateful bean 'jboss.j2ee:service=EJB3,name=LebenBerechnungBean' (EJB3 4.3.13)
                     
              at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:73)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                      at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:97)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                      at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                      at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                      at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
                      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
                      at $Proxy355.destroy(Unknown Source)


              regards,
              Karl