Stateful session beans cannot be used concurrently.

Discussions

EJB programming & troubleshooting: Stateful session beans cannot be used concurrently.

  1. iam using weblogic6.0 with service pack two,i have a stateless bean taking to stateful bean,so when multiple requests are sent to statelessbean which call the methods of stateful bean, iam getting the following exception, please can u explain why iam getting this exception.

    javax.transaction.TransactionRolledbackException: java.rmi.RemoteException: Stateful session beans cannot be used concurrently.
           at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSessionManager.java:165)
           at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSessionManager.java:149)
           at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:232)
           at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
           at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
           at com.mphasis.engine.bin.TxEngineBeanEOImpl.Execute(TxEngineBeanEOImpl.java:94)
           at com.mphasis.engine.bin.TxEngineBeanEOImpl_WLSkel.invoke(TxEngineBeanEOImpl_WLSkel.java:128)
           at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java:373)
           at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java:237)
           at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestHandler.java:118)
           at weblogic.rmi.internal.BasicRequestDispatcher.dispatch(BasicRequestDispatcher.java:115)
           at weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:88)
           at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:108)
           at com.mphasis.engine.bin.TxEngineBeanEOImpl_WLStub.Execute(TxEngineBeanEOImpl_WLStub.java:377)
           at com.mphasis.txmanager.bin.TxManagerBean.processMessage(TxManagerBean.java:600)
           at com.mphasis.txmanager.bin.TxManagerBeanImpl.processMessage(TxManagerBeanImpl.java:110)
           at com.mphasis.txmanager.bin.TxManagerBean.onMessage(TxManagerBean.java:408)
           at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1933)
           at weblogic.jms.client.JMSSession.execute(JMSSession.java:1892)
           at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
           at weblogic.kernel.Kernel.execute(Kernel.java:250)
           at weblogic.jms.client.JMSSession.pushEnvelope(JMSSession.java:1779)
           at weblogic.jms.client.JMSCallback.pushEnvelope(JMSCallback.java:69)
           at weblogic.jms.frontend.FESession.execute(FESession.java:1972)
           at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
           at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
     nested exception is:
           java.rmi.RemoteException: Stateful session beans cannot be used concurrently.priting remote exception in txmanagerjava.rmi.RemoteException: Stateful se
           at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSessionManager.java:165)
           at weblogic.ejb20.manager.StatefulSessionManager.acquireLock(StatefulSessionManager.java:149)
           at weblogic.ejb20.manager.StatefulSessionManager.preInvoke(StatefulSessionManager.java:232)
           at weblogic.ejb20.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:113)
           at weblogic.ejb20.internal.StatefulEJBObject.preInvoke(StatefulEJBObject.java:148)
           at com.mphasis.engine.bin.TxEngineBeanEOImpl.Execute(TxEngineBeanEOImpl.java:94)
           at com.mphasis.engine.bin.TxEngineBeanEOImpl_WLSkel.invoke(TxEngineBeanEOImpl_WLSkel.java:128)
           at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java:373)
           at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.java:237)
           at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestHandler.java:118)
           at weblogic.rmi.internal.BasicRequestDispatcher.dispatch(BasicRequestDispatcher.java:115)
           at weblogic.rmi.internal.ServerRequest.sendOneWayRaw(ServerRequest.java:88)
           at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:108)
           at com.mphasis.engine.bin.TxEngineBeanEOImpl_WLStub.Execute(TxEngineBeanEOImpl_WLStub.java:377)
           at com.mphasis.txmanager.bin.TxManagerBean.processMessage(TxManagerBean.java:600)
           at com.mphasis.txmanager.bin.TxManagerBeanImpl.processMessage(TxManagerBeanImpl.java:110)
           at com.mphasis.txmanager.bin.TxManagerBean.onMessage(TxManagerBean.java:408)
           at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1933)
           at weblogic.jms.client.JMSSession.execute(JMSSession.java:1892)
           at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
           at weblogic.kernel.Kernel.execute(Kernel.java:250)
           at weblogic.jms.client.JMSSession.pushEnvelope(JMSSession.java:1779)
           at weblogic.jms.client.JMSCallback.pushEnvelope(JMSCallback.java:69)
           at weblogic.jms.frontend.FESession.execute(FESession.java:1972)
           at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
           at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
  2. This is directly from the EJB spec. Any concurrent request on an EJB will result in a remote exception. It isn't a bug in the app server and shouldn't be a surprise.

    Whether or not you agree with the spec is a completely different matter. :)

    Bob