1 Reply Latest reply on Sep 24, 2004 11:46 AM by s champailler

    CMP EJBs prevent concurrent access ?

    s champailler Newbie

      I have a servlet which does two things :

      1- Create a new instance of an EJB x
      2- findAll() the EJB x
      3- show the EJB content in the resulting HTML

      (so, basically : add an item to a list, find all the items in the list)

      The EJB is CMP.

      I open my browser and call the servlet. Everything works as expected.

      Now, I hit the refresh button a lot of times so to add plenty of items and stress the system a bit.

      Now and then, I got an excpetion telling me that concurrent access to the EJB are not allowed. I guess it's because sometimes I use the "getter" method of bean instance that is being created.

      I really don't understand why that happens (I've read a lot and it seems that the container should do the proper serialization for me) and I don't know what to do to fix that.

      Can someone help me ? Or better, direct me to the proper documentation I have to read to understand that better ?

      Thank you


        • 1. Re: CMP EJBs prevent concurrent access ?
          s champailler Newbie

          I think I have found my mistake.

          In the servlet, I had a reference (instance variable) to a stateful session bean. In the doPost/doGet method, I was accessing that bean (bean.getBlabla()). So when I was hitting my refresh button, the servlet doPost/doGet was called concurrently and therefore, the bean.getBlabla() was called concurrently as well. That is forbidden, as explained in section 7.5.6 of EJB 2.0 specification.