1 Reply Latest reply on May 25, 2005 9:36 AM by Nikolay Tsankov

    Recursive EJB creation

    Nikolay Tsankov Newbie

      Hi,

      While migrating a complex application from 3.2.6 to 4.0.2, I had a strange problem.

      In one of the components (ear), two ejbs were creating each other recursivly (both are stateless session beans). What I mean is that EJB1 has a field holding an instance of EJB2's remote interface and in EJB1#ejbCreate() method this filed is initialized by looking up the home interface and calling create(). The same happens in EJB2's ejbCreate() method - only it calls create on the first bean's home interface. The component also deploys an MBean (sar), which in it's start() method (ie while deploying) tries to create the first ejb.

      The strange thing is that this has worked without problems in 3.2.6 and previous versions. With 4.0.2 the behaviour is somewhat random. Sometimes the server freezes without finishing deployment, sometimes a weird exc. is thrown - "java.lang.NoClassDefFoundError: javax/ejb/TransactionRolledbackLocalException" with a very long stacktrace showing the mutual recursion of the two ejbCreate() methods. And very rarely the expected java.lang.StackOverflowError is thrown.

      Any comments are wellcome, 10x