5 Replies Latest reply on Oct 9, 2003 12:57 PM by mafuertes

    JNDI problem- lookup for an ejb object: javax.naming.NamingE

    mafuertes Newbie

      Hi all,

      I get the following error when trying to lookup for an ejb object (calling the method javax.naming.InitialContext.lookup("EjbObject"), and I have been desperately looking to solve it for a long time with no success. The error I get from Tomcat is the following:

      75338 [Thread-5] INFO common.FrontControllerServlet - REQUEST RECEIVED
      75368 [Thread-5] INFO common.ServiceLocator - service name to lookup:ejb/BLController
      javax.naming.NameNotFoundException: El nombre ejb no este asociado a este contexto
      at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at esharing.service.common.ServiceLocator.getEJBHome(Unknown Source)
      at esharing.webtier.common.FrontControllerServlet.processRequest(Unknown
      Source)
      at esharing.webtier.common.FrontControllerServlet.doPost(Unknown Source)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)



      -The code that calls the EJB from a server page is the following:

      try {
      InitialContext ic = new InitialContext();
      Object objRef = ic.lookup("AccessControlManager");
      AccessControlManagerHome home = (AccessControlManagerHome)PortableRemoteObject.narrow(objRef, AccessControlManagerHome.class);
      accmanager = home.create();
      } catch (RemoteException ex) {
      System.out.println("Couldn't create AccessControlManager bean."+ ex.getMessage());
      } catch (CreateException ex) {
      System.out.println("Couldn't create AccessControlManager bean."+ ex.getMessage());
      } catch (NamingException ex) {
      System.out.println("Unable to lookup home: "+ "AccessControlManager "+ ex.getMessage());
      }

      I have tried with a changes in the web.xml file and jndi.properties file but it does not work anyway.
      Could you please help me?

      Thank you.

      Miguel