2 Replies Latest reply on Jul 7, 2003 11:58 AM by gatep5

    ejb-ref found in jboss.xml but not in ejb-jar.xml

    gatep5

      I have an entity bean (BlogEJB) packaged in its own jar file and it deploys in JBoss just fine. I would like to reference it from a session bean (BlogAdderEJB) that is again packaged in its own jar file. In the BlogEJB I have defined a local home interface. In the session bean I have a declaration of <ejb-local-ref> tag defined in the ejb-jar file and an <ejb-ref> declaration in the jboss.xml file. Here is my package listing for each of the jar files.

      [BlogEJB]
      |-META-INF
      |-+ejb-jar.xml
      |-+jboss.xml
      |-+jbosscmp-jdbc.xml
      |-net.gatep5.weblog.ejb.entity (package)
      |-+Blog (remote interface)
      |-+BlogHomeRemote (remote home interface)
      |-+BlogHomeLocal (local home interface)
      |-+BlogLocal (local interface)
      |-+BlogBean (bean class)

      [BlogAdderEJB]
      |-META-INF
      |-+ejb-jar.xml
      |-+jboss.xml
      |-net.gatep5weblog.ejb.session (package)
      |-+BlogAdderHomeRemote (remote home interface)
      |-+BlogAdderRemote (remote interface)
      |-+BlogAdderBean (bean class)

      the <ejb-local-ref> as defined in the ejb-jar.xml file for the session ejb is a follows:

      <ejb-local-ref>
      <ejb-ref-name>ejb/BlogHomeLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type> <local-home>net.gatep5.weblog.ejb.entity.BlogHomeLocal</local-home>
      net.gatep5.weblog.ejb.entity.BlogLocal
      <ejb-link>BlogEJB</ejb-link>
      </ejb-local-ref>

      I have defined in my jboss.xml file the <ejb-ref> in the session ejb as follows:
      <ejb-ref>
      <ejb-ref-name>ejb/BlogHomeLocal</ejb-ref-name>
      <jndi-name>BlogEJB</jndi-name>
      </ejb-ref>

      I still keep getting the error message that is the subject of this post when I try to deploy the session ejb. You assitance in helping me figure out what the problem is is much appreciated! Thanks in advance!

      Keith

        • 1. Re: ejb-ref found in jboss.xml but not in ejb-jar.xml
          haraldgliebe

          You don't need the ejb-ref in jboss.xml for a local ejb-reference. Just remove the complete ejb-ref entry from jboss.xml. The reference is already linked to an EJB with the ejb-link element in ejb-jar.xml. However, since the bean you're referencing is in a different jar, you need to specify it in your ejb-link.

          <ejb-link>../BlogEJB.jar#BlogEJB</ejb-link>

          Regards,
          Harald

          • 2. Re: ejb-ref found in jboss.xml but not in ejb-jar.xml
            gatep5

            Ok, the bean will now deploy. I managed to put all the class files and deployment descriptors in the same ejb file. Now, as before when the items were seperated, I am getting a METHOD IS NOT FOUND exception being thrown when trying to use a getBlog method that calles the BlogEJB to findByDate(String date). When I use the other getBlog method that looks up the BlogEJB by primary key, I get:
            BlogHomeLocal not bound. Any clues would be very helpful.

            Keith