3 Replies Latest reply on Mar 4, 2004 7:01 AM by milowe

    Concurrent calls on stateful session bean

    chetana_vir

      Hi,

      I have written two beans and deployed them succefully in a single jar file. Using a simple client program i called the first bean method where i am lookingup the second bean and passing the EJBObject (retrieved from the sessioncontext), as a parameter to the method in the second bean. Using this ejbobject from the second bean i am calling another method in the first bean. Calling beans in such a way i am getting the following exception. I could understand that since client and second bean at a time calling the first bean the exception is coming. If i am correct then how to make a bean to be called concurrently by two different clients at a time.

      Here is the exception i am getting in the jboss console i am using jboss-3.0.8 server.


      javax.ejb.EJBException: Application Error: no concurrent calls on stateful beans
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceIn
      terceptor.java:249)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:237)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
      at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:380)
      at org.jboss.ejb.Container.invoke(Container.java:738)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:99)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:117

        • 1. Re: Concurrent calls on stateful session bean
          milowe

          This is not allowed (EJB prohibits concurrent access to bean instances).
          You could try to re-design your solution, maybe add an extra layer.

          • 2. Re: Concurrent calls on stateful session bean
            chetana_vir

            Hi milowe,

            then what is the use of retrieving EJBObject from the SessionContext object. I think weblogic server allows concurrent calls to stateful bean. Does jboss doesn't support or it is not allowed at all. I am new to ejb please give me clear information.

            chetana

            • 3. Re: Concurrent calls on stateful session bean
              milowe

              Its an EJB spec thing menaing its by default not allowed by any app server. Any client can have any number of EJBs references. Any single EJB instance can never accept concurrent calls to its business methods.
              You are talking about the EJBObject from SessionContext in the tricky sequence :

              EJB A -> EJB B -> EJB A

              There are other cases when you want to pass a reference as a method argument or result.