1 Reply Latest reply on Jul 25, 2002 6:08 PM by russf

    JBoss 3.0.0, JBuilder 7, Protegra 2.2 - bad XML

    russf

      This is a workaround to "expected only one ejb-relation-name tag" errors, and may help people make progress until a real fix is issued.

      When I save in EJBDesigner, several XML files are created.
      The file jbosscmp-jdbc.xml contains incorrect XML, which causes an error "expected only one ejb-relation-name tag" in the JBoss log while deploying.

      An extract of the bottom part of the incorrect file is here...


      <ejb-relation>
      <ejb-relation-name>category-product</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>

      <ejb-relationship-role-name>CategoryRelationshipRole</ejb-relationship-role-name>
      <ejb-designer-id>Category</ejb-designer-id>
      </ejb-relationship-role>
      <ejb-relationship-role>

      <ejb-relationship-role-name>ProductRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      <ejb-relation-name>customer-address</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>

      <ejb-relationship-role-name>CustomerRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      <ejb-relationship-role>

      <ejb-relationship-role-name>AddressRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      </ejb-relation>

      </jbosscmp-jdbc>



      And the hand corrected XML, which deploys correctly, is here...


      <ejb-relation>
      <ejb-relation-name>category-product</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>

      <ejb-relationship-role-name>CategoryRelationshipRole</ejb-relationship-role-name>
      <ejb-designer-id>Category</ejb-designer-id>
      </ejb-relationship-role>
      <ejb-relationship-role>

      <ejb-relationship-role-name>ProductRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      </ejb-relation> ** Added
      <ejb-relation> ** Added
      <ejb-relation-name>customer-address</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>

      <ejb-relationship-role-name>CustomerRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      <ejb-relationship-role>

      <ejb-relationship-role-name>AddressRelationshipRole</ejb-relationship-role-name>
      </ejb-relationship-role>
      </ejb-relation>

      </jbosscmp-jdbc>

      My workaround, today at least, is to hand edit the file after changes on teh EJBDesigner page, and rebuild the jar and ear.
      Before each <ejb-relation-name> after the first, add the two lines as shown, to terminate the first relationship and open the second.

      I'll be interested to know the best place to take this kind of issue. I have another problem, possibly related, with EJB-QL errors that I will dianose next.


      --r.