6 Replies Latest reply on Dec 28, 2003 1:36 AM by Jon Barnett

    Confusion over the JNDI name and Context lookup

    Dave Everson Newbie

      I am having some confusion about the jndi-names defined in the deployment xml file and then later used to retrieve an EJB.

      I have the following EJB defined in the jboss.xml file:


      In the class which accesses this bean contains the code, the following code fails:

      initialContext = new InitialContext();
      Object object = initialContext.lookup("ejb/mygolftrac/UserBeanHome");
      userHome = (UserBeanHome) javax.rmi.PortableRemoteObject.narrow(object, UserBeanHome.class);

      When I change the second line above as follows:
      Object object = initialContext.lookup("UserBean");

      I am access the EJB.

      I was under the assumption that I should be using the JNDI-name when doing the lookup.

      What am I missing, why doesn't the jndi-name defined in the jboss.xml file work?