5 Replies Latest reply on Sep 17, 2002 4:17 AM by runeteigen

    does JBoss support ejb-local-ref in web.xml?

    chumps

      Hello,

      I'm trying to have a servlet link to a local EJB. Here is the relevant web.xml declaration I have in test.war:
      <ejb-local-ref>
      <ejb-ref-name>CanliiPublicationBrokerEJB</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>org.canlii.ejb.CanliiPublicationBrokerLocalHome</local-home>
      org.canlii.ejb.CanliiPublicationBrokerLocal
      <ejb-link>CanliiPublicationBrokerEJB</ejb-link>
      </ejb-local-ref>

      Here is the relevent section in ejb-jar.xml located in my jar module named canliidb.jar:


      <display-name>CanliiPublicationBrokerEJB</display-name>
      <ejb-name>CanliiPublicationBrokerEJB</ejb-name>
      <local-home>org.canlii.ejb.CanliiPublicationBrokerLocalHome</local-home>
      org.canlii.ejb.CanliiPublicationBrokerLocal
      <ejb-class>org.canlii.ejb.CanliiPublicationBrokerEJB</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Container</transaction-type>
      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>


      When I deploy these modules separatly I get the following error:

      org.jboss.deployment.DeploymentException: ejb-local-ref: CanliiPublicationBrokerEJB, target not found, add valid ejb-link; - nested throwable: (javax.naming.NamingException: ejb-local-ref: CanliiPublicationBrokerEJB, target not found, add valid ejb-link)

      I even tried to package these modules together in an ear but I get the same error. Am I doing something wrong? Does JBoss support local references to EJBs in servlets?
      Thanks,

        • 1. Re: does JBoss support ejb-local-ref in web.xml?
          ra9114

          Hi,

          Even i am getting the same Exception while deploying.
          I am using the local interfaces.

          If u have found the solution , pl let us know .

          Thanks

          • 2. Re: does JBoss support ejb-local-ref in web.xml?
            apanchal74

            I am alos facing the same problem please let me know if u got solution

            • 3. Re: does JBoss support ejb-local-ref in web.xml?

              ejb-local-ref only works when the .war and target
              ejb are in the same ear.

              Regards,
              Adrian

              • 4. Re: does JBoss support ejb-local-ref in web.xml?

                I assume you are using JBoss 3.x.

                Sun's DTD for web.xml says that you may specify the jar-file of the EJB in the ejb-link element. The path of the jar should be relative to the war-file. In this case your ejb-link might look like this:
                <ejb-link>canliidb.jar#CanliiPublicationBrokerEJB</ejb-link>
                I do not now whether this is supported on JBoss. (Probably not according to the above replay.)

                I do have it working with the war and jar packaged together in an ear-file, though. In this case the reference to the jar-file in the ejb-link is not supported ('canliidb.jar#').

                My ear contains SomeEJBs.jar and TheWebApp.war on the same level in the ear. The application.xml looks like this:



                SomeEJBs.jar



                <web-uri>TheWebApp.war</web-uri>
                <context-root>/</context-root>




                My ejb-link elements in web.xml refer directly to the ejb-names of the ejb-jar.xml.

                • 5. Re: does JBoss support ejb-local-ref in web.xml?

                  Just a thought: Is is possible to use the same name of the ejb-ref (as defined by ejb-ref-name element) as that of your bean (ejb-link element)? The DTD says that ejb-ref-name must be unique within the web-application. It is also recommended to prefix it with 'ejb/'.