9 Replies Latest reply on Oct 16, 2003 8:17 PM by crosscourt

    ejb-ref in web.xml

    crosscourt Newbie


      what is the correct syntax for the ejb-ref tag?
      I tried the following but jboss complains about the ejb-link?

      I am trying to deploy a ear file which contains a jar for my ejbs. I deploy a test.war file for cactus that test my "local" ejbs but i can't get the ejb-link right? I can still lookup the ejb through a jndi lookup but I want to use COMP_NAME lookup (is it better?).

      where "ejb/user/UserValidatorLocal" is the local-jndi-name.


      It used to work when i use

      but now i deploy with tds.ear? and nothing works


        • 1. Re: ejb-ref in web.xml
          crosscourt Newbie

          and the error:

          no ejb-link match, use jndi-name in jboss-web.xml

          • 2. Re: ejb-ref in web.xml
            Adrian Brock Master

            <ejb-link>{<ejb-name> you want to reference}</ejb-link>


            <ejb-link>relative path to jar#{<ejb-name> you want to reference}</ejb-link>


            • 3. Re: ejb-ref in web.xml
              crosscourt Newbie

              what if the jar is inside a ear?
              so EAR has the ejb jar and web app war?


              • 4. Re: ejb-ref in web.xml
                crosscourt Newbie

                More info:

                I'm trying to access local ejbs from normal java classes in my webapp inside the .war file through the java:comp namespace.

                • 5. Re: ejb-ref in web.xml
                  Adrian Brock Master

                  Prove to me you know what you are doing:

                  1) Show the ejb deployment descriptors, specifically what
                  <local-jndi-name> does the local interface have.
                  default is local/<ejb-name> if you don't change it jboss.xml

                  2) Show the packaging of the ear so I can see where the
                  ejb jar and war are located and what their names are.
                  jar -tf tds.ear

                  3) Show the web.xml you are actually using.

                  4) Post the full error message


                  • 6. Re: ejb-ref in web.xml
                    crosscourt Newbie

                    yeah, i don't really know what i'm doing but here we go:

                    With xdoclet, i define the local jndi name
                    * @ejb.bean
                    * name="service/AdminService"
                    * type="Stateless"
                    * display-name="Administration Service Session Bean"
                    * local-jndi-name="ejb/service/AdminServiceLocal"
                    * view-type="local"



                    jar -tf tds.ear




                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE web-app
                    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"


                    <!-- Action Servlet Configuration -->


                    <!-- Action Servlet Mapping -->

                    <!-- The Welcome File List -->

                    <!-- Application Tag Library Descriptor -->

                    <!-- Struts Tag Library Descriptors -->
                    <!-- EJB References -->



                    11:52:09,437 ERROR [AdminServiceDelegateImpl] Cannot find AdminServiceEJB
                    11:52:09,437 ERROR [STDERR] javax.naming.NameNotFoundException: ejb not bound
                    11:52:09,437 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                    11:52:09,437 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                    11:52:09,437 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                    11:52:09,437 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
                    11:52:09,437 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
                    11:52:09,437 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
                    11:52:09,437 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:642)
                    11:52:09,437 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
                    11:52:09,437 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
                    11:52:09,437 ERROR [STDERR] at tds.interfaces.AdminServiceUtil.getLocalHome(AdminServiceUtil.java:28)
                    11:52:09,437 ERROR [STDERR] at tds.admin.delegate.support.AdminServiceDelegateImpl.(AdminServiceDele

                    AdminServiceDelegateImpl.java is a class inside the war file that tries to locate the AdminServiceEJB with the util class generated from xdoclet which uses
                    public static final String COMP_NAME="java:comp/env/ejb/service/AdminServiceLocal";

                    i tried diff combinations of <ejb-link> and only one jboss doesn't complain is

                    thanks for you time

                    • 7. Re: ejb-ref in web.xml
                      crosscourt Newbie

                      oh, TradeDataService.jar == tds.jar
                      sorry for the inconsistency

                      • 8. Re: ejb-ref in web.xml
                        Adrian Brock Master



                        • 9. Re: ejb-ref in web.xml
                          crosscourt Newbie

                          ok thanks,

                          i think this works

                          but what about ejb-ref for an external war for my test classes?

                          so i deploy tds.ear and test.war and i need to access the ejb from the classes in test.war?