Using CMR collection with commit A does not work ?
andreasronge Apr 11, 2003 4:53 AM
I get the following error message
"java.lang.IllegalStateException: The iterator of a CMR collection may only be used within the transction in which it was created"
when using an iterator of a CMR collection in a CMP entity bean.
This bean is only called from a stateless sessionbean with the required tx attribute an all methods.
The collection/iterator is only used inside the entity bean.
I suspect that the container use the same iterator when the session bean
is called by two concurrent clients.
However, commit option B does work.
Is this a bug that is related to Bug item #575815, or I'm a doing something wrong ?
(https://sourceforge.net/tracker/?func=detail&atid=376685&aid=575815&group_id=22866)
I'm using jboss-3.0.4_tomcat-4.0.6, jdk1.4.1_02
The CMP entity bean function that throws the exception:
private void doesNotWork() {
Collection c = getACmrCollection();
Iterator iter = c.iterator();
while (iter.hasNext()) { // throws an Exception
...
}
}
Stack trace:
java.lang.IllegalStateException: The iterator of a CMR collection may only be used within the transction in which it was created
at org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet$1.verifyIteratorIsValid(RelationSet.java:309)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet$1.hasNext(RelationSet.java:269)
at se.mcs.configuration.entitybean.ejb.ConfigurationBean.getHashtableFromPropertiesCollection(Unknown Source)
at se.mcs.configuration.entitybean.ejb.ConfigurationBean.getConfigurationValue(Unknown Source)
at sun.reflect.GeneratedMethodAccessor55.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.invoke(EntityContainer.java:1194)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:95)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:297)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:90)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)
at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:301)
at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
...
Regards
Andreas