2 Replies Latest reply on May 13, 2003 9:55 PM by jdyao

    accessing local interfaces across jars

    famousactress

      I'm trying to deploy two jars. One jar contains my domain model, implemented as entitybeans which expose local interfaces. The other jar contains my SessionBeans, which reference and use the entities in the other jar.

      Is this supported? I'm getting EJB not bound errors when the SessionBeans try to access the entities. I've tried a variety of deployment descriptor syntax, with no luck.

      Will this only work if I pack them in an EAR? Can I pack more than one ejb-jar in an EAR?

      any help would be appreciated. Thanks.

      -Phill

        • 1. Re: accessing local interfaces across jars

          Hi. I has the same problem when accessing local interfaces across jars.

          I found the last source code :
          importEjbJarXml(Element element)
          {
          ....
          // set the ejb local references
          iterator = getChildrenByTagName(element, "ejb-local-ref");

          while (iterator.hasNext())
          {
          Element ejbLocalRef = (Element) iterator.next();

          EjbLocalRefMetaData ejbLocalRefMetaData = new EjbLocalRefMetaData();
          ejbLocalRefMetaData.importEjbJarXml(ejbLocalRef);

          ejbLocalReferences.put(ejbLocalRefMetaData.getName(),
          ejbLocalRefMetaData);
          }
          ....
          }


          importJbossXml(Element element)
          {
          ........
          // set the external ejb-references (optional)
          iterator = getChildrenByTagName(element, "ejb-ref");
          while (iterator.hasNext())
          {
          Element ejbRef = (Element)iterator.next();
          String ejbRefName = getElementContent(getUniqueChild(ejbRef,
          "ejb-ref-name"));
          EjbRefMetaData ejbRefMetaData = getEjbRefByName(ejbRefName);
          if (ejbRefMetaData == null)
          {
          throw new DeploymentException("ejb-ref " + ejbRefName
          + " found in jboss.xml but not in ejb-jar.xml");
          }
          ejbRefMetaData.importJbossXml(ejbRef);
          }

          ........
          }

          That is, the local bean don't support crossing jar?
          If you want to access the local bean (in other jar) by it's jndi name and don't config the 'ejb-local-ref' infomation in ejb-jar.xml , it will throw NameNotFoundException.

          • 2. How to accessing local interface when crossing jar.

            A local bean in A.jar,
            B local bean in B.jar , B will accessing A bean.
            the B ejb-jar.xml config like these.
            <ejb-local-ref >
            <ejb-ref-name>ejb/ASession</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <local-home>common.ASessionLocalHome</local-home>
            common.ASessionLocal
            <ejb-link>A.jar#ASession</ejb-link>
            </ejb-local-ref>

            It may help you resolve these problem.
            A.jar, B.jar locate './deploy/' directory.