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

    Can't get example to work

    robc

      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: 193.118.5.76;

      Now my IP is actually 192.118.5.67. 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)

      Thanks

      Rob

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

          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

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

            Regards,
            Adrian

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

              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 10.0.0.51. When I get my initial context, I have proved that I am using a "java.naming.provider.url" value of 10.0.0.17, but I always get the above exception trying to open a socket of 63.230.24.210, 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 10.0.0.51 could even know of or discover 63.230.24.210.

              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 10.0.0.17, I get the same ConnectIOException telling me that it can't open a connection to 63.230.24.210. If I bind the naming service to 63.230.24.210, I get the java.net.ConnectException exception.

              When I disable the 63.230.24.210 ip address and try to connect to JBoss from 10.0.0.51, 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), 63.230.24.210 is just a made-up ip address used for this discussion only.

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

                Did you set the hostname property?

                rmi binds to one ip address, whatever it thinks is
                localhost.

                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.

                e.g.
                on 10.0.0.* it points to 10.0.0.17
                elsewhere it points to 63.230.24.210

                Regards,
                Adrian

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

                  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=10.0.0.17 and it worked perfectly.

                  Thanks Adrian!

                  Paul