3 Replies Latest reply on Sep 22, 2005 7:39 AM by Darran Lofthouse

    StackOverflow in Stateless bean : 4.0.2

    Chetan Aggarwal Newbie

      Hi all

      I have two stateless session beans.

      //Stateless bean A
      public class A implements SessionBean
      {
      public void setSessionContext(SessionContext sc){

      InitialContext in = new InitialContext();
      BHome bhome = in.lookup("B");
      B b = bhome.create();
      }
      .....
      }

      //Stateless bean B
      public class B implements SessionBean
      {
      public void setSessionContext(SessionContext sc){

      InitialContext in = new InitialContext();
      AHome ahome = in.lookup("A");
      A a = ahome.create();
      }
      .....
      }

      As per abovecode , i am creating bean B in setSession context of A and bean A in setSessionContext of B.

      This code is working fine in JBOSS 4.0.1 .
      But in JBOSS 4.0.2 , it is throwing :

      Caused by: java.lang.StackOverflowError
      2005-09-22 13:25:27,187 INFO [STDOUT] javax.transaction.TransactionRolledbackException: Could not instantiate bean; CausedByException is:
      null; nested exception is:
      javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
      null
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:244)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:116)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:613)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:894)
      2005-09-22 13:25:27,187 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
      2005-09-22 13:25:27,187 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2005-09-22 13:25:27,187 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      2005-09-22 13:25:27,187 INFO [STDOUT] at $Proxy56.create(Unknown Source)
      2005-09-22 13:25:27,187 INFO [STDOUT] at beansproject.Stateless2.setSessionContext(Stateless2.java:40)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseContext.java:52)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:35)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:161)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:78)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:116)
      2005-09-22 13:25:27,187 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:613)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:894)
      2005-09-22 13:25:27,203 INFO [STDOUT] at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
      2005-09-22 13:25:27,203 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2005-09-22 13:25:27,203 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
      2005-09-22 13:25:27,203 INFO [STDOUT] at $Proxy58.create(Unknown Source)
      2005-09-22 13:25:27,203 INFO [STDOUT] at beansproject.Stateless1.setSessionContext(Stateless1.java:39)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseContext.java:52)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:35)
      2005-09-22 13:25:27,203 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:161)


      Please suggest what i need to make it work in JBOSS 4.0.2

      Thanks and regards,
      Chetan