2 Replies Latest reply on Apr 7, 2006 5:08 AM by akuehne

    EJBException: CMR field value is already loaded


      Hi all,

      I am trying to perform stress testing of my Customer beans. Every now and then even under light load, I get the following exception:

      javax.ejb.EJBException: CMR field value is already loaded
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge$FieldState.loadRelations(JDBCCMRFieldBridge.java:1813)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(JDBCCMRFieldBridge.java:1312)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(JDBCCMRFieldBridge.java:1301)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceValue(JDBCCMRFieldBridge.java:646)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(JDBCCMRFieldBridge.java:599)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler$FieldGetInvoker.invoke(EntityBridgeInvocationHandler.java:133)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:91)
      at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:62)

      My configuration is as follows:

      jboss version 3.2.5.
      I am using JDBCOptimisticLock and a commit option of A. The bean has a transaction attribute of "Required" and is called from a session facade. The CMRs have a read-ahead attribute set to on-find with a page size of 100.

      I will really appreciate any help on this issue.

      Thanks a lot.


        • 1. Re: EJBException: CMR field value is already loaded

          Hi all,

          After waiting for the jboss support to response, (no one did), I out of desperation looked at the jboss code. The class in question is


          This class has a method called loadRelations which throws the above exception as follows:

          public void loadRelations(Collection values)
          throw new EJBException("CMR field value is already loaded");

          I noticed that this exception is thrown when the relation is already loaded. So, I experimented with the following change:

          public void loadRelations(Collection values)

          Instead of throwing exception, I just return. I ran my stress test again and it ran like a charm without a problem.

          I hope that the CMP team can have a look at this and let me know if this will have any serious side effects. So far, I have not some across any.

          I know this is a bad thing to do (changing server code). But I pretty much tried every other way possible....


          • 2. Re: EJBException: CMR field value is already loaded

            I do suffer from this problem, too.
            Is there any progress seen here in the meantime ?

            I would agree that just returning instead of throwing an Exception is kind of hack. The problem I guess is the unsynchronized use of the 'isLoaded' flag.

            In my application the Exceptions usually occurs with two MDBs working with the same entity beans in parallel. Maybe there is a unsuffient isolation of contexts ??

            Any ideas welcome ..