3 Replies Latest reply on May 14, 2004 3:13 PM by sesques

    cmp entity bean deployment

    ais Newbie

      Hi,

      When deploying some cmp entitity beans, I get the following exception:

      I am using jboss3.2.3, ms sqlserver2000.

      My 3 xml-s look allright to me, please help me if you know what the problem might be.


      org.jboss.deployment.DeploymentException: Role 'ChainRelationshipRole' on Entity Bean 'Chain' : CMP field for key not found: field name='chainId'
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKeyFields(JDBCRelationshipRoleMetaData.java:432)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JDBCRelationshipRoleMetaData.java:188)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(JDBCRelationMetaData.java:339)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:470)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:75)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:706)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:409)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:357)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:152)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:342)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      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:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy26.start(Unknown Source)
      at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      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:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy14.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy12.start(Unknown Source)
      at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy6.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:476)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:201)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:274)
      at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:192)
      at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:976)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:394)
      at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy4.start(Unknown Source)
      at org.jboss.deployment.SARDeployer.start(SARDeployer.java:226)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
      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:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy5.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:384)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:291)
      at org.jboss.Main.boot(Main.java:150)
      at org.jboss.Main$1.run(Main.java:395)
      at java.lang.Thread.run(Thread.java:534)

        • 1. Re: cmp entity bean deployment
          sesques Novice

           

          "ais" wrote:
          Hi,

          When deploying some cmp entitity beans, I get the following exception:

          I am using jboss3.2.3, ms sqlserver2000.

          My 3 xml-s look allright to me, please help me if you know what the problem might be.


          org.jboss.deployment.DeploymentException: Role 'ChainRelationshipRole' on Entity Bean 'Chain' : CMP field for key not found: field name='chainId'
          at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKeyFields(JDBCRelationshipRoleMetaData.java:432)
          ...


          If you conclude yourself, nothing we can do for you. The error is explicit so look carefully at your descriptors around the chainId field declaration (in the bean and in the relationship).
          If you remain in a dead end, post your descriptors here.

          Pascal


          • 2. Re: cmp entity bean deployment
            ais Newbie

            Hi,

            I come back with some additional info.

            I generated the relations using jbuilderx (my advice to you never use this!!!, I discovered that is not working corectly)

            jbosscmp-jdbc.xml


            <ejb-name>Company</ejb-name>
            <table-name>COMPANY</table-name>
            <cmp-field>
            <field-name>addressId</field-name>
            <column-name>ADDRESSID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>companyId</field-name>
            <column-name>COMPANYID</column-name>
            <auto-increment/>
            </cmp-field>
            <cmp-field>
            <field-name>companySizeId</field-name>
            <column-name>COMPANYSIZEID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>companyTypeId</field-name>
            <column-name>COMPANYTYPEID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>defaultCurrencyId</field-name>
            <column-name>DEFAULTCURRENCYID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>versionNumber</field-name>
            <column-name>VERSIONNUMBER</column-name>
            </cmp-field>
            <entity-command name="mssql-fetch-key" />


            <ejb-name>VenueInformation</ejb-name>
            <table-name>VENUEINFORMATION</table-name>
            <cmp-field>
            <field-name>chainid</field-name>
            <column-name>CHAINID</column-name>
            </cmp-field>
            <cmp-field>
            <field-name>venueInformationId</field-name>
            <column-name>VENUEINFORMATIONID</column-name>
            <auto-increment/>
            </cmp-field>
            <entity-command name="mssql-fetch-key" />

            ....

            <ejb-relation>
            <ejb-relation-name>company-venueinformation</ejb-relation-name>
            <ejb-relationship-role>
            <ejb-relationship-role-name>CompanyRelationshipRole</ejb-relationship-role-name>
            <key-fields>
            <key-field>
            <field-name>venueInformationId</field-name>
            <column-name>VENUEINFORMATIONID</column-name>
            </key-field>
            </key-fields>
            </ejb-relationship-role>
            <ejb-relationship-role>
            <ejb-relationship-role-name>VenueinformationRelationshipRole</ejb-relationship-role-name>
            <key-fields>
            <key-field>
            <field-name>venueInformationId</field-name>
            <column-name>VENUEINFORMATIONID</column-name>
            </key-field>
            </key-fields>
            </ejb-relationship-role>
            </ejb-relation>

            ejb-jar.xml


            <display-name>Company</display-name>
            <ejb-name>Company</ejb-name>
            <local-home>com.xxx.data.company.CompanyHome</local-home>
            com.xxx.data.company.Company
            <ejb-class>com.xxx.data.company.CompanyBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            False
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>Company</abstract-schema-name>
            <cmp-field>
            <field-name>addressId</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>companyId</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>companySizeId</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>companyTypeId</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>defaultCurrencyId</field-name>
            </cmp-field>
            <primkey-field>companyId</primkey-field>


            <display-name>VenueInformation</display-name>
            <ejb-name>VenueInformation</ejb-name>
            <local-home>com.xxx.data.venue.information.VenueInformationHome</local-home>
            com.xxx.data.venue.information.VenueInformation
            <ejb-class>com.xxx.data.venue.information.VenueInformationBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            False
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>Venueinformation</abstract-schema-name>
            <cmp-field>
            <field-name>chainid</field-name>
            </cmp-field>
            <cmp-field>
            <field-name>venueInformationId</field-name>
            </cmp-field>
            <primkey-field>venueInformationId</primkey-field>



            Please take a look and tell me what is wrong here?

            Do you know any tool for generating relations between cmp entity beans?

            tia

            • 3. Re: cmp entity bean deployment
              sesques Novice

              Manifestly, not all your descriptors are in the post.
              The error talks about a "ChainRelationshipRole" relationship role in your Chain bean. None of them (entity bean and relationship) is in your descriptors.

              I suggest you to use XDoclet to generate descriptors.

              Pascal