2 Replies Latest reply on Nov 1, 2002 7:52 PM by Andrew Shea

    A funning Naming Problem

    kammi Newbie

      My Jboss server(Jboss3.0 with tomcat4.0) running on a linux server,
      ip is 10.23.96.218

      when I start my client programming from windows use the command line like this

      C:\jdk13\bin\javaw
      -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      -Djava.naming.provider.url=10.23.96.218:1099
      -Djava.naming.factory.url.pkgs=org.jboss.naming doll.HomeManager

      It report the following 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: connect
      java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:323)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:136)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:123)
      at java.net.Socket.(Socket.java:273)
      at java.net.Socket.(Socket.java:100)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:445)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at doll.HomeManager.getHome(HomeManager.java:29)


      The naming part of my code look like this:

      Context ctx = new InitialContext();
      System.out.println(ctx.getEnvironment());
      Object ref = ctx.lookup(jndi); //-----------line 29
      homes.put(jndi,ref);

      and System.out.println(ctx.getEnviroment()) produce following output:
      {java.naming.provider.url=10.23.96.218:1099,
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
      java.naming.factory.url.pkgs=org.jboss.naming:com.sun.enterprise.naming}


      Then I do some work on my linux server(10.23.96.218).
      /etc/hosts looks like

      127.0.0.1 localhost.localdomain localhost

      I change it to

      10.23.96.218 localhost.localdomain localhost

      then, I restart my jboss server
      and run my test client on windows, Now it do works.

      Why this happen? why need I change the hosts file?
      Is this a bug of jboss ?