5 Replies Latest reply on Jun 10, 2004 6:13 AM by Volker

    3.2.4 CMP Bug

    Corby Page Newbie

      The following problem does not exist in 3.2.3, but appears when I deploy under 3.2.4.

      I am using default CMP container settings for commit-option, read-ahead, etc.

      My BrokerSplit EJB has a one-to-many relationship with Deals. It also has a one-to-many relationship with Users. So, the fields of the EJB are:

      Deal (CMR)
      User (CMR)
      ID: PK Field
      Commission: CMP Field

      My use case is that I call deal->getBrokerSplit(), followed by getters on the Broker Split object. I have tried reordering my getter invocations, and have had the same results each time.

      The getId() call is always successful.

      The getUser() call is always successful (I don't know if it matters, but the User instance has always been previously loaded in another context).

      The getCommission() call fails with the following behavior:

      Lines 109-113 of JDBCLoadEntityCommand:

      // load any preloaded fields into the context
      if(readAheadCache.load(ctx))
      {
      return true;
      }

      This call returns true, so that no SQL is actually executed on the load.

      This return goes back down the call stack to lines 177-179 of JDBCCMP2xFieldBridge:

      manager.loadField(this, ctx);
      if(!fieldState.isLoaded())
      throw new EJBException("Could not load field value: " + getFieldName());

      The manger.loadField() call is how we got to JDBCLoadEntityCommand. But on return the test to fieldState.isLoaded() fails, causing it to throw the exception "Could not load field value: commission".

      It appears that the engine is making an incorrect assessment as to whether the field is being loaded into the read-ahead cache, but I'm reaching the limits of my capabilities here.

      Thanks,
      Corby

        • 1. Re: 3.2.4 CMP Bug
          Alexey Loubyansky Master

          Fixed in 3.2.4RC2 and HEAD.

          Index: JDBCLoadEntityCommand.java
          ===================================================================
          RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCLoadEntityCommand.java,v
          retrieving revision 1.19.2.23
          diff -r1.19.2.23 JDBCLoadEntityCommand.java
          112c112,115
          < return true;
          ---
          > if(requiredField != null && requiredField.isLoaded(ctx))
          > {
          > return true;
          > }
          


          Thanks!

          • 2. Re: 3.2.4 CMP Bug
            Alexey Loubyansky Master

            The next one is

            Index: JDBCLoadEntityCommand.java
            ===================================================================
            RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCLoadEntityCommand.java,v
            retrieving revision 1.19.2.24
            diff -r1.19.2.24 JDBCLoadEntityCommand.java
            112c112
            < if(requiredField != null && requiredField.isLoaded(ctx))
            ---
            > if(requiredField == null || (requiredField != null && requiredField.isLoaded(ctx)))
            


            • 3. Re: 3.2.4 CMP Bug
              Volker Newbie

              Hello,

              having a problem with CMP in 3.2.4 (June 4th 2004 Version). Looks like the one mentioned above, so I enter the same thread.

              Setup is a CMR with a "campaignInstance" entity bean that has "agentInstance" entity beans as children. The code works fine using commit-levels B or C, but not with commit level A:

              Jboss tries to access the field "outputType" from an "agentInstance", whereas "outputType" is not used in the application at this point in time (and has not been used before). Other fields from the "agentInstance" shall be accessed. Then the error "Could not load field value: outputType" occurs.

              2004-06-08 18:08:01,340 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.CampaignInstance] Executing SQL: SELECT startDate FROM SAM_CMP_RUNTIME WHERE (id=?)
              2004-06-08 18:08:01,340 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.CampaignInstance] Executing SQL: SELECT startDate FROM SAM_CMP_RUNTIME WHERE (id=?)
              2004-06-08 18:08:01,350 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.CampaignInstance] Executing SQL: SELECT stopDate FROM SAM_CMP_RUNTIME WHERE (id=?)
              2004-06-08 18:08:01,350 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.CampaignInstance] Executing SQL: SELECT stopDate FROM SAM_CMP_RUNTIME WHERE (id=?)
              2004-06-08 18:08:01,350 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.CampaignInstance] load relation SQL: SELECT id FROM SAM_AGT_RUNTIME WHERE (cmp_inst_id=?)
              2004-06-08 18:08:01,350 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.CampaignInstance] load relation SQL: SELECT id FROM SAM_AGT_RUNTIME WHERE (cmp_inst_id=?)
              2004-06-08 18:08:01,370 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.lang.String net.ehp.campaign.ejb.AgentInstanceLocal.getOutputType(), causedBy:
              javax.ejb.EJBException: Could not load field value: outputType
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.getInstanceValue(JDBCCMP2xFieldBridge.java:179)
              at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge.getValue(JDBCAbstractCMPFieldBridge.java:208)
              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)
              at net.ehp.campaign.ejb.AgentInstanceCMP$Proxy.getOutputType(<generated>)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              ...


              Any hints or fixes are highly appreciated.

              Regards

              Volker

              • 4. Re: 3.2.4 CMP Bug
                Alexey Loubyansky Master

                And when you update your 3.2.4 with the fixes above, do you still have the problem?

                • 5. Re: 3.2.4 CMP Bug
                  Volker Newbie

                  I apologize, I assumed the fixes were in my build already ... this was incorrect.

                  It now works with A too.

                  Volker