12 Replies Latest reply on Dec 30, 2002 7:21 AM by raphael

    JNDI lookup always returns null

    rfrey

      I'm clearly missing some configuration detail, but a scouring of the advanced docs and the forums hasn't given me a clue.

      My session EJBs seem to be getting registered correctly with the naming service. JNDIView reveals them living where I expect them to be: under the global namespace with names such as UserManager.

      I can browse the JBoss naming service using a number of JNDI browsing tools, such as the jndi browser from EJTools http://sourceforge.net/projects/ejtools.

      However, any attempt to connect to the naming server from a foreign host fails. There is no exception thrown: any lookup simply returns null. The JNDI browser mentioned above says the root context is null.

      Here's some sample code I'm running:

      System.out.println("1");
      java.util.Hashtable env = new java.util.Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "jnp://10.0.0.2:1099/");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      env.put("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");
      env.put("jnp.timeout", "0");
      env.put("jnp.sotimeout", "0");
      Context context = new InitialContext(env);
      System.out.println("2");
      Object pmhObj = context.lookup(pmJndiName);
      System.out.println("3, " + pmhObj);
      PartnerManagerHome pmh = (PartnerManagerHome)javax.rmi.PortableRemoteObject.narrow(
      pmhObj, PartnerManagerHome.class);
      System.out.println("4");


      The code works perfectly if run on the same machine (from a different VM than JBoss). If run from a different machine, context.lookup(pmJndiName) returns null. No connection exception or anything like that is thrown.

      I'm using JBoss 3.0.4. There's no firewall running on the JBoss server.

      I'm stumped! I've tried mucking with hostnames, RMI settings (there was a 127.0.0.1 error that required rmi hostname fiddling: this ain't it), PROVIDER_URL arguments, and various other hail-Mary solutions. Sleeping on it for a week hasn't worked either. =)

      Thanks in advance for any help.