3 Replies Latest reply on May 22, 2004 12:38 PM by ironbird

    Bean not found for relation

    agoncal

      Hi,

      Based on the PetStore I've got the following CMP EntityBeans

      Order & OrderItem -> both packaged in order-ejb.jar
      Category & Product & Item -> packaged in catalog-ejb.jar

      And OrderItem has a link to Item (both CMPs are in a different jar).

      Both jars are put into a .ear file and when I deploy it in JBoss 3.2.3 I've got the following exception:

      DeploymentException: Entity: ItemBean not found for relation: orderItem-item
      Here is part of the ejb-jar.xml file

      <ejb-relation>
      <ejb-relation-name>orderItem-item</ejb-relation-name>

      <ejb-relationship-role>
      <ejb-relationship-role-name>orderItem-refers_to-item</ejb-relationship-role-name>
      Many
      <cascade-delete/>
      <relationship-role-source>
      <ejb-name>OrderItemBean</ejb-name>
      </relationship-role-source>
      <cmr-field>
      <cmr-field-name>item</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>item-is_refered_by-orderItems</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>ItemBean</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>


      Because OrderItem has a link to Item which is in different jar file I've added in the classpath of the Manifest (of order-ejb.jar) the catalog.jar file. But it still doesn't work.

      Is there any issue due to the seperate jars ?

      Thanks,

      Antonio

        • 1. Re: Bean not found for relation
          gorano

          You can have your entities in different jars, no problem.

          Do you have the beans defined in different deployment descriptors?

          You can't have separate dds . Both beans have to be defined in the same dd if you have a cmr
          relationship between them.

          • 2. Re: Bean not found for relation
            agoncal

            Thanks, I've put all the entities in only one jar with only one deployment descriptor and it's working fine.

            Is the constraint "both beans have to be defined in the same dd if you have a cmr relationship between them" defined in the spec (I haven't found anything) or is this a JBoss limitation ?

            • 3. Re: Bean not found for relation
              ironbird

              It is perfectly defined in the spec and the descriptor schema:

              <xsd:complexType name="ejb-nameType">
              <xsd:annotation>
              <xsd:documentation>
              The ejb-nameType specifies an enterprise bean’s name. It is
              used by ejb-name elements. This name is assigned by the
              ejb-jar file producer to name the enterprise bean in the
              ejb-jar file’s deployment descriptor. The name must be
               unique among the names of the enterprise beans in the same
               ejb-jar file.There is no architected relationship between the used
              ejb-name in the deployment descriptor and the JNDI name that
              the Deployer will assign to the enterprise bean’s home.
              The name for an entity bean must conform to the lexical
              rules for an NMTOKEN.
              Example:
              <ejb-name>EmployeeService</ejb-name>
              </xsd:documentation>
              </xsd:annotation>
              

              For the ejb-name, you can use a path name relative to the referencing ejb-jar file. Appends the ejb-name of the referenced bean to the path name separated by #.