-
Bug
-
Resolution: Done
-
Major
-
JBossAS-3.2.8.SP1, JBossAS-4.0.4.GA, JBossAS-5.0.0.Beta2
-
None
-
Workaround Exists
-
I beleive, I encountered a bug in jboss 4.0.4 GA.
We have an BMP entity bean(SWRecord in trace below) with a valueobject as an interface with a client. Client can pass the valueobject to the ejbCreate method with incompletely filled data. SWRecord fills missing data on ejbPostCreate, using several other beans by their finders.
The problem is that findSingleObject causes the sync of the entities in the transaction including bean that currently in ejbPostCreate - Jboss calls ejbStore on that bean.
I beleive, that's direct violation of EJB2 spec, since ejbStore could be called only on bean in Ready state, and it can only be Ready after ejbPostCreate returns.
Here is a stacktrace taken from the ejbStore of non-created bean (I'm sure it's the same entity - I checked with debugger).
Adrian Brock: I've snipped the stack trace to the relevant information and added comments:
<!-- ejbStore() is invoked here -->
at com.supportwizard.dml.ejb.SWRecordBMP.ejbStore(SWRecordBMP.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb.plugins.BMPPersistenceManager.invokeEjbStore(BMPPersistenceManager.java:498)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeEjbStore(CachedConnection
Interceptor.java:294)
at org.jboss.ejb.EntityContainer.invokeEjbStore(EntityContainer.java:735)
at org.jboss.ejb.GlobalTxEntityMap$2.invokeEjbStore(GlobalTxEntityMap.java:132)
<!-- Because the GlobalTxEntityMap knows the context -->
at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:281)
at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(GlobalTxEntityMap.java:208)
at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:136)
<!-- The synchronization/flush occurs because of the finder -->
at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1100)
at org.jboss.ejb.EntityContainer.find(EntityContainer.java:721)
<!-- snipped -->
at $Proxy341.findByChildColumnID(Unknown Source)
at com.supportwizard.dictionary.SWChoiceBean.getPossibleChoiceLines(SWChoiceBean.java:219)
<!-- Which is invoked from an SLSB -->
at $Proxy352.getPossibleChoiceLines(Unknown Source)
at com.supportwizard.cachewrappers.SWChoiceCacheWrapper.getPossibleChoiceLines(SWChoiceCacheWrapper
.java:87)
<!-- Invoked from ejbPostCreate -->
at com.supportwizard.dml.ejb.SWRecordBean.ejbPostCreate(SWRecordBean.java:381)
<!-snipped->
at $Proxy1189.create(Unknown Source)
at com.supportwizard.dml.ejb.SWRecordCreatorBean.com$supportwizard$dml$ejb$SWRecordCreatorBean$crea
teRecord$aop(SWRecordCreatorBean.java:259)