2 Replies Latest reply on Feb 6, 2007 7:40 AM by Vassil Stoyanov

    Stateless session bean cyclic reference

    Vassil Stoyanov Newbie

      I am having the following issue:

      There is an application in which the stateless beans are referencing each other cyclically, because they have to use each others' methods. It is done with the Local interface.

      Unfortunately, each SLB is obtaining references to the others in its ejbCreate() which causes a endless loop (actually it ends - with a StackOveflowException). However the application runs just fine on jboss prior to 4.0.2 and on several other appservers.

      So the facts are - the app is perfectly running on jboss 4.0.1 and prior, and when run on jboss 4.0.2 it crashes uppon the first SLB creation with a mile-long stack trace and StackOverflowException.

      We have also tried running it on various jre's, to assure that it is not a low-level problem.

      I have read through the jboss forums and have seen a post by one of the jboss team members which says that the two significant changes in jboss from 4.0.1 to 4.0.2 are the hibernate version and the classloading model. Hibernate isn't used in that project.

      We've tried various configuration file modifications including <ignore-dependencies /> and setting a explicit CL repository with <loader-repository> in the jboss-application.xml.

      Unfortunately none of this really gave any result. So I wonder if it might be a jboss problem (e.g. bug introduced in the 4.0.2 version or st.)

      I can give a simple application, we made to idenrify the problem, which has only 2 stateless session beans calling each other in the same fashion like the real app. It has the same behaviour - working on the jb <=4.0.1 and glassfish and geronimo and crashing on jb >=4.0.2

        • 1. Re: Stateless session bean cyclic reference
          jaikiran pai Master

          What is the code that you have in the ejbCreate() method. Are you just looking up the bean's home or are you even calling create() method on the home interface? If you are just doing a lookup, then i dont think you would run into this issue. So i guess, you might be calling the create() method on the home interface after looking it up. Any reason why you are doing this in the ejbCreate() method?

          • 2. Re: Stateless session bean cyclic reference
            Vassil Stoyanov Newbie

            Yes, you are right. There is a call to the create() method of the home interface. I am aware that it is not a good practice but it would require a lot of refactoring to move it out of the ejbCreate() method, because there are many SLSBs.

            So, I am asking if someone has an idea how can we just make it work like it works in jboss 4.0.1- and the other app-servers in order to evade that refactoring