5 Replies Latest reply on Mar 22, 2002 12:40 PM by Paul

    Can't get example to work

    Rob Newbie

      I can create the Interest bean and when I put it in the deploy directory it deploys fine. My realy problem is with the client. When the following code in the client is executed
      Object ref = jndiContext.lookup("interest/Interest");

      I get the following error:

      javax.naming.CommunicationException. Root exception is java.rmi.ConnectIOException: Exception creating connection to:;

      Now my IP is actually Where is this IP address comming from and how can I set it (I'm sorry, I do realise this is probably a really simple question to answer, but I'm a complete newbie at this)



        • 1. Re: Can't get example to work
          Paul Newbie

          I'm having the same problem--not with the example, but with my own application.

          I get this problem from my client machine. The JBoss server is running on a W2K machine that has two NICs--each with it's own subnet (one internal [10.0.0.?], and the other external). The client machine is on the internal subnet, but the naming service is returning the external subnet's ip address of the other card. When the naming lookup process tries to open a socket to the returned ip address, the error mentioned above occurs. The error makes sense, because I have intentionally made it so that the two subnets can not talk to each other.

          I have spent a signicant amount of time trying to get the naming service to only be used on the internal subnet, but I have been unsuccessful. I tried using the BindAddress attribute for the naming service, but that did not fix the problem (it's possible that I did not use the BindAddress attribute properly--I couldn't find any documentation, so I just entered the ip address of the internally defined NIC).

          Does anyone know how force the naming service to use (and return) only one ip address when the server actually has two?

          • 2. Re: Can't get example to work
            Adrian Brock Master

            This is in FAQ forum
            Have a look at connection refused to host


            • 3. Re: Can't get example to work
              Paul Newbie

              The posting in the FAQ forum was instructive, but I still always get the java.rmi.ConnectIOException. I believe I am dealing with a bug in the naming provider.

              My client machine is When I get my initial context, I have proved that I am using a "java.naming.provider.url" value of, but I always get the above exception trying to open a socket of, which is the ip address of the other card in my JBoss server. Since they are on different subnets, I know that I am hitting the JBoss machine, because there is no way that could even know of or discover

              If I attempt to connect to the JBoss server when JBoss is shut down, then I get a java.net.ConnectException. If JBoss is running, and the naming service has been bound to, I get the same ConnectIOException telling me that it can't open a connection to If I bind the naming service to, I get the java.net.ConnectException exception.

              When I disable the ip address and try to connect to JBoss from, I can successfully get my initial context.

              So, any time I have both ip addresses enabled on my JBoss server, it always returns the ip address of the card on the other, external, subnet--even though the client request was made across the internal subnet with the "java.naming.provider.url" set to the internal subnet's ip address of the JBoss server (when I say return, I mean to the jnp-client code path).

              By the way (in case I caused anyone shock), is just a made-up ip address used for this discussion only.

              • 4. Re: Can't get example to work
                Adrian Brock Master

                Did you set the hostname property?

                rmi binds to one ip address, whatever it thinks is

                If you use hostnames instead, you can use
                the client's host table (or a dns on each sub-network)
                to bind the host name to the correct ip address for
                that sub-network.

                on 10.0.0.* it points to
                elsewhere it points to


                • 5. Re: Can't get example to work
                  Paul Newbie

                  As I continued to research, I eventually came back to the topic referenced above, and finally I realized that I had not picked up on the -Djava.rmi.server.hostname entry. So, as instructed, I set it to
                  -Djava.rmi.server.hostname= and it worked perfectly.

                  Thanks Adrian!