Title: IllegalStateException: The iterator of a CMR collection may only be used within the transction in which it was created

Jboss 3.0.4, CMP2.0 bean, simple business method is called by remote client. Method declaration is:

    public String getSizeAsString(Locale locale) {
      try {
        int size = 0;
316:    for (Iterator i = getSlides().iterator(); i.hasNext(); ) {
          size+=((Slide)i.next()).getSize();
        }
        size+=getXml(false, false, -1, locale).toString().getBytes("UTF-8").length;
        return new DecimalFormat("0.00").format((double)size/1024D);
      }catch (UnsupportedEncodingException ex) {
        throw new EJBException(ex);
      }
    }

From time to time (not every time, approx one time for 20 invocations) I get the exception below. All transaction attributes for all beans in application declared as:

        <container-transaction>
            <method>
                <description />
                <ejb-name>SMIL</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>

Looks pretty much like a bug because of reproduce instability.

2002-11-05 17:54:20,987 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException:
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 com.tw.mms.ejb.SMILBean.getSizeAsString(SMILBean.java:316)
        at sun.reflect.GeneratedMethodAccessor75.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.Container.invoke(Container.java:712)
        at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
        at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
        at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:536)

Best wishes,
  Alexei Yudichev

Reply via email to