3 Replies Latest reply on Mar 19, 2004 11:53 PM by robjuh

    Remote JNDI lookup always returns empty JNDI directory

    robjuh

      I have an application that runs on Jboss 3.2.3 (W2K and RH), with a client application needing to do a lookup to grab a session bean. Everything works fine as long as the client is on the same machine as the server. As soon as I try to do the JNDI lookup on a remote server, the JNDI directory appears to be empty to the client.

      I then wrote a test class that does a listBindings() on the InitialContext. Whenever I try to list bindings for the context that I know exists, it'll give the following error:

      javax.naming.CommunicationException. Root exception is java.rmi.NoSuchObjectException: no such object in table
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jnp.server.NamingServer_Stub.listBindings(Unknown Source)
      at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:747)
      at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:735)
      at javax.naming.InitialContext.listBindings(InitialContext.java:396)
      at com.blastradius.buildman.test.Test.main(Test.java:26)

      public class Test {
      public static void main(String[] args) {
      try {
      Hashtable contextProperties = new Hashtable();
      contextProperties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      contextProperties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      contextProperties.put("java.naming.provider.url", "jnp://nolan.radius:8099");

      InitialContext initialContext = new InitialContext(contextProperties);
      System.out.println(initialContext.getEnvironment().toString());
      NamingEnumeration enum = initialContext.listBindings("buildman/ejb");
      System.out.println(enum.toString());

      while (enum.hasMoreElements()) {
      System.out.println(enum.next().toString());
      }
      }
      catch (NamingException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
      }
      }
      }

      If I do try it with "java:" instead, I get back an empty org.jnp.interfaces.NamingEnumerationImpl

      I also set the bind address for jboss to the IP address of the box. When I telnet to the IP and the port I run JNDI on (8099), I get garbage back with the RMI url being the correct IP address.

      Any ideas?