1 Reply Latest reply on Aug 16, 2002 8:14 PM by Dain Sundstrom

    Hint:Avoid whitespace i names

    Lars Hagrot Newbie

      I always got the 'An ejb-relationship-role element was not found for role' when I deployed.

      I declared the following One-to-Many relation
      in my ejb-jar.xml.....

      <ejb-relation>
      <ejb-relation-name>Customer-Order</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>
      Customer-Has-Orders
      </ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>CustomerEntity</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>orderEntities</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>
      Order-Has-Customer
      </ejb-relationship-role-name>
      Many
      <cascade-delete/>
      <relationship-role-source>
      <ejb-name>OrderEntity</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>customerEntity</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>



      I also declared the declaration i jbosscmp-jdbc.xml

      <ejb-relation>
      <ejb-relation-name>Customer-Order</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Customer-Has-Orders</ejb-relationship-role-name>
      <fk-constraint>true</fk-constraint>
      <key-fields>
      <key-field>
      <field-name>customerId</field-name>
      <column-name>customer_id</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>Order-Has-Customer</ejb-relationship-role-name>
      </ejb-relationship-role>
      </ejb-relation>

      I deployed and deployed and deployed and deployed but
      always got an excpetion like

      10:30:55,812 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$Deploy
      L@a7d8592b{ url=file:/C:/java/jboss-3.0.0/server/default/deploy/profapp.ear, deployedLastModified=1029486545714 }
      org.jboss.deployment.DeploymentException: error in create of EjbModule: njar:file:/C:/java/jboss-3.0.0/server/defaul
      p/deploy/server/default/deploy/profapp.ear/92.profapp.ear^/prof-ejb.jar; - nested throwable: (org.jboss.deployment.D
      ymentException: An ejb-relationship-role element was not found for role '
      Customer-Has-Orders
      ')


      After a couple of days and a lot of coffee I finally realized my problem was the white space.


      So you can not map

      <ejb-relationship-role-name>
      Customer-Has-Orders
      </ejb-relationship-role-name>

      to

      <ejb-relationship-role-name>Customer-Has-Orders</ejb-relationship-role-name>


      Now I have learned but I my suggestion is that JBoss should strip leading and trailing whitespace before comparing names.