4 Replies Latest reply on Feb 27, 2008 3:50 PM by lamprecht

    remote JNDI lookup fails

    lamprecht

      Hi,

      I've a problem reaching JDNI from a remote, standalone client. The lookup is done by the following code:

      Properties props = new Properties();
      props.setProperty("java.naming.provider.url", "jnp://server:1099");
      props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
      props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
       InitialContext ctx = new InitialContext(props);
      result = ctx.lookup(path);


      It runs perfect on the host "server". But when I run it on a different host, I get an exception:
      javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
       java.net.ConnectException: Connection refused]
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at mdb.test.client.Lookup.lookup(Lookup.java:49)
       at mdb.test.client.jms_client.main(jms_client.java:23)
      Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
       java.net.ConnectException: Connection refused
       at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
       at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
       at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
       at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
       ... 4 more


      What surprises me is, that the client seems to try to connect to localhost, even though the provider URL points to a different host.

      There are no firewalls between the two maschines. JBoss (4.2.2GA) is listening on the respective IP/port on the server, I can reach it with telnet.

      If I shutdown JBoss, I get a different error message. Therefore I assume, that the client is connecting to the server.

      Thanks in advance,

      Heiner