1 Reply Latest reply on Dec 10, 2002 8:10 PM by glm

    Deployment Error

    glm Newbie

      Hi;
      I am using JBoss3.2.0beta2 and have run into a problem deploying a CMP Entity Bean that has a compound PK. The PK is made up of two fields, BoxId and PackId. The error that occurs is the following:

      2002-12-03 21:20:20,464 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Boxes] Loading standardjbosscmp-jdbc.xml : file:/D:/jboss-3.2.0beta2_tomcat-4.1.12/server/default/conf/standardjbosscmp-jdbc.xml
      2002-12-03 21:20:20,714 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.Boxes] jar:file:/D:/jboss-3.2.0beta2_tomcat-4.1.12/server/default/tmp/deploy/server/default/deploy/packingAgent.jar/92.packingAgent.jar-contents/META-INF/boxPool.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults
      2002-12-03 21:20:20,845 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.parentTraceEnabled=true
      2002-12-03 21:20:20,845 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.nestedTraceEnabled=false
      2002-12-03 21:20:20,845 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNesting=true
      2002-12-03 21:20:20,835 ERROR [org.jboss.ejb.EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Mappings were not provided for all fields: unmaped fields=[boxId]
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.loadKeyFields(JDBCRelationshipRoleMetaData.java:390)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData.init(JDBCRelationshipRoleMetaData.java:157)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.(JDBCRelationMetaData.java:313)
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.(JDBCApplicationMetaData.java:404)


      The following is my jbosscmp-jdbc.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC '-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN' 'http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd'>
      <jbosscmp-jdbc>

      java:/DefaultDS
      <datasource-mapping>mySQL</datasource-mapping>

      <enterprise-beans>

      <ejb-name>Boxes</ejb-name>
      java:/DefaultDS
      <datasource-mapping>mySQL</datasource-mapping>
      <table-name>boxes</table-name>
      <cmp-field>
      <field-name>boxId</field-name>
      <column-name>BoxId</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>packId</field-name>
      <column-name>PackId</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>length</field-name>
      <column-name>Length</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>width</field-name>
      <column-name>Width</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>height</field-name>
      <column-name>Height</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>maxWeight</field-name>
      <column-name>MaxWeight</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>boxWeight</field-name>
      <column-name>BoxWeight</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>type</field-name>
      <column-name>Type</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>packingThickness</field-name>
      <column-name>PackingThickness</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>boxPrice</field-name>
      <column-name>BoxPrice</column-name>
      </cmp-field>


      <ejb-name>Packing</ejb-name>
      java:/DefaultDS
      <datasource-mapping>mySQL</datasource-mapping>
      <table-name>packing</table-name>
      <cmp-field>
      <field-name>status</field-name>
      <column-name>Status</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>recordStatus</field-name>
      <column-name>RecordStatus</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>packingThickness</field-name>
      <column-name>PackingThickness</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>id</column-name>
      </cmp-field>

      </enterprise-beans>

      <ejb-relation>
      <ejb-relation-name>boxes-packing</ejb-relation-name>
      <foreign-key-mapping></foreign-key-mapping>
      <ejb-relationship-role>
      <ejb-relationship-role-name>BoxesRelationshipRole</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>packId</field-name>
      <column-name>id</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>PackingRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      </ejb-relation>

      </jbosscmp-jdbc>


      and this is my ejb-jar.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>Boxes</display-name>
      <ejb-name>Boxes</ejb-name>
      <local-home>com.gopack.boxpool.BoxesHome</local-home>
      com.gopack.boxpool.Boxes
      <ejb-class>com.gopack.boxpool.BoxesBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.gopack.boxpool.BoxesPK</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Boxes</abstract-schema-name>
      <cmp-field>
      <field-name>boxId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>packId</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>length</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>width</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>height</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>maxWeight</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>boxWeight</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>type</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>packingThickness</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>boxPrice</field-name>
      </cmp-field>

      <query-method>
      <method-name>findAll</method-name>
      <method-params />
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql>SELECT Object(b) FROM Boxes b</ejb-ql>


      <query-method>
      <method-name>findByPackId</method-name>
      <method-params>
      <method-param>java.lang.Integer</method-param>
      </method-params>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql>Select Object(b) from Boxes b where b.packId = ?1</ejb-ql>



      <display-name>Packing</display-name>
      <ejb-name>Packing</ejb-name>
      <local-home>com.gopack.boxpool.PackingHome</local-home>
      com.gopack.boxpool.Packing
      <ejb-class>com.gopack.boxpool.PackingBean</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>Packing</abstract-schema-name>
      <cmp-field>
      <field-name>status</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>recordStatus</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>packingThickness</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      <primkey-field>id</primkey-field>

      </enterprise-beans>

      <ejb-relation>
      <ejb-relation-name>boxes-packing</ejb-relation-name>
      <ejb-relationship-role>
      boxes
      <ejb-relationship-role-name>BoxesRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      boxes
      <ejb-name>Boxes</ejb-name>
      </relationship-role-source>
      <cmr-field>
      packing
      <cmr-field-name>packing</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      packing
      <ejb-relationship-role-name>PackingRelationshipRole</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      packing
      <ejb-name>Packing</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>Boxes</ejb-name>
      <method-name>*</method-name>


      <ejb-name>Packing</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>


      can someone tell me what is causing this error?

      Thanks,

      Gary Marsh

        • 1. Re: Deployment Error
          glm Newbie

          There appears to be a discrepancy between the CMP documentation and the jbosscmp-jdbc_3_0.dtd. The documentation shows and example of the jbosscmp-jdbc.xml having the following node order :

          &lt;relationships&gt;
          &lt;ejb-relation&gt;
          &lt;ejb-relation-name&gt;Order-LineItem&lt;/ejb-relation-name&gt;
          &lt;foreign-key-mapping&gt;

          &lt;ejb-relationship-role&gt;

          &lt;!-- exdented to fit on a printed page --&gt;
          &lt;ejb-relationship-role-name&gt;order-has-lineitems&lt;/ejb-relationship-role-name&gt;

          &lt;foreign-key-fields/&gt;
          &lt;/ejb-relationship-role&gt;

          &lt;ejb-relationship-role&gt;

          &lt;!-- exdented to fit on a printed page --&gt;
          &lt;ejb-relationship-role-name&gt;lineitem-belongsto-order&lt;/ejb-relationship-role-name&gt;

          &lt;foreign-key-fields&gt;
          &lt;foreign-key-field&gt;
          &lt;field-name&gt;ordernumber&lt;/field-name&gt;
          &lt;column-name&gt;ORDER_NUMBER&lt;/column-name&gt;
          &lt;/foreign-key-field&gt;
          &lt;/foreign-key-fields&gt;
          &lt;/ejb-relationship-role&gt;

          &lt;/foreign-key-mapping&gt;
          &lt;/ejb-relation&gt;
          &lt;/relationships&gt;



          while the jbosscmp-jdbc.dtd indicates that the foreign-key-mapping tag is to be "EMPTY". The following is from the dtd :

          &lt;!ELEMENT foreign-key-mapping EMPTY&gt;


          This is also what the Open-Source tool for JBuild6 is doing.

          Can someone clarify this for me or at least tell me which is correct?

          Thanks,

          Gary Marsh