1 Reply Latest reply on Aug 16, 2002 1:05 AM by Dain Sundstrom

    CMR deploy problem

    niksa_os Newbie

      I have JBuilder7 and Jboss3 wizard generated jbosscmp-jdbc.xml.
      I can run this ear with WebLogic and BEs5 but I can't with jboss-3.0.1RC1_tomcat-4.0.4.

      I can't deploy this ear to JBoss. This is error:

      org.jboss.deployment.DeploymentException: CMP field for key not found: field name=userTypeId
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKeyFields(JDBCRelationshipRoleMetaData.java:374)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JDBCRelationshipRoleMetaData.java:157)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(JDBCRelationMetaData.java:308)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:383)

      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:75)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:677)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:389)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:339)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)

      ---------------- ejb-jar.xml ----------------------------

      <ejb-relation>
      <ejb-relation-name>user-userType</ejb-relation-name>
      <ejb-relationship-role>
      user
      <ejb-relationship-role-name>UserRelationshipRole1</ejb-relationship-role-name>
      One
      <relationship-role-source>
      user
      <ejb-name>User</ejb-name>
      </relationship-role-source>
      <cmr-field>
      userType
      <cmr-field-name>userType</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      userType
      <ejb-relationship-role-name>UserTypeRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      userType
      <ejb-name>UserType</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      ------------------ jbosscmp-jdbc.xml ------------------------------

      <ejb-relation>
      <ejb-relation-name>user-userType</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>
      <ejb-relationship-role-name>UserRelationshipRole1</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>userTypeId</field-name>
      <column-name>UserTypeId</column-name>
      </key-field>
      </key-fields>
      <ejb-designer-id>User</ejb-designer-id>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>UserTypeRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      </ejb-relation>

      -----------------------------------------------------------

      create table if not exists USER (
      id int PRIMARY KEY not null AUTO_INCREMENT,
      UserTypeId int not null,
      LoginName varchar(32) UNIQUE not null,
      Password varchar(32) not null,
      FirstName varchar(32) not null,
      LastName varchar(32) not null,
      ...................................

      create table if not exists USER_TYPE
      (
      id int PRIMARY KEY not null AUTO_INCREMENT,
      UserType varchar(32) UNIQUE not null,
      UserTypeDescription varchar(255)
      );


      This is 1:1 relation. USER_TYPE is read-only.