5 Replies Latest reply on Sep 21, 2009 2:04 PM by Brad Warren

    remote JNDI lookup problem

    Brad Warren Novice

      I'm trying to access JNDI remotely in JBoss 5. I'm getting a connection refused on the client which I suspect is caused by the server launch config.

      Here's how I'm connecting on the client:

       Properties p = new Properties();
       p.put("java.naming.provider.url", "jnp://myServerDNSname:1099");
       p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
       context = new InitialContext(p);
      


      Here's the exception:

      Caused by: java.net.ConnectException: Connection refused: connect
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      ...
      


      I was launching jboss on the server using -b 0.0.0.0. After reading http://www.jboss.org/community/wiki/UsingJBossBehindAFirewall I tried changing it to various things:

      -b 0.0.0.0
      -b myServerIP
      -b myServerIP -Djboss.bind.address=0.0.0.0
      -b myServerIP -Djboss.bind.address=0.0.0.0 -Djava.rmi.server.hostname=myServerIP -Djava.rmi.server.useLocalHostname=false
      


      All of them produce the same error on the remote client. The server's not behind a firewall (that I know of) so I don't have an external/internal IP translation to worry about. I'm able to telnet to port 1099 on the server and it looks like it returns the JNDI context.

      When I try to connect from the client, if I go to the server quickly and do a netstat I can see my client connection coming in with a status of TIME_WAIT:

      $ netstat -an | grep 1099
      tcp 0 0 0.0.0.0:1099 0.0.0.0:* LISTEN
      tcp 0 0 10.52.201.71:1099 10.12.23.116:3367 TIME_WAIT
      


      Does anyone see what I'm doing wrong in the server config?