1 Reply Latest reply on Jan 26, 2004 2:28 PM by Juha Lindfors

    BMP ejbUpdate loop

    John Wagg Newbie

      I am having a problem porting our application from JBoss 3.2.1 to 3.2.3. My current problem is an infinite loop occuring during an update of a BMP entity bean. The outer session bean method has a transaction attribute of 'required'. This method uses a BMP home interface to do a findByPrimaryKey. It does this again for a second BMP entity bean. It then does a get for just one column in the first entity. Then it does a different get for the second entity bean. All the BMP entity bean methods have a 'required' transaction attribute. On calling the second get method JBoss has decided that it needs to update the first BMP entity bean. i.e. it calls ejbStore on the bean. I'm not sure why it should feel the need to do this but it does. The problem is that it then gets into a loop. The ejbStore method for the bean is doing a findByPrimaryKey and a series of sets for one of two possible CMP entity beans. All the methods for these two CMP beans are 'required' transaction attributes as well. It eventually gets a stack overflow but the stack trace shows that the update for the CMP bean it has chosen forces another ejbStore for the BMP bean and so on.

      Here's a section of the stack trace showing one loop

      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:293)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy214.findByPrimaryKey(Unknown Source)
      at com.axxia.pkc.core.afcl.entity.common.dualfuel.DFCamatgrpBean.update(DFCamatgrpBean.java:555)
      at com.axxia.pkc.core.afcl.entity.common.dualfuel.DFCamatgrpBean.ejbStore(DFCamatgrpBean.java:459)
      at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:454)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:387)
      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:714)
      at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(GlobalTxEntityMap.java:149)
      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:119)
      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:607)
      at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1043)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:197)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:214)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:89)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:483)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:293)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy214.findByPrimaryKey(Unknown Source)
      at com.axxia.pkc.core.afcl.entity.common.dualfuel.DFCamatgrpBean.update(DFCamatgrpBean.java:555)
      at com.axxia.pkc.core.afcl.entity.common.dualfuel.DFCamatgrpBean.ejbStore(DFCamatgrpBean.java:459)
      at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)


      All this stuff worked fine with JBoss 3.2.1, (with JDK 1.3.1, if that's relevant). Moving to 3.2.3 (with JDK 1.4.2) is causing huge problems.