5 Replies Latest reply on Jul 21, 2004 10:26 AM by stefanfreyr

    Problem with messages over a network.

    blinso

      Hello,

      I have a problem with sending messages over a network.

      I have a message driven bean which receives messages over a Queue and a statefull session bean which sends messages over a topic.

      To test this, I have written a small Java client program which sends messages to the message driven bean and listens for messages from the stateful session bean.

      If the client runs on the same computer as JBoss, all works. But if the client runs on a different computer, only sending oft the messages work, but the client don't receive messages.

      JBoss prints the following debug/error message, when the client on the other computer is started:

      2003-09-18 13:12:06,845 DEBUG [org.jboss.mq.il.oil.OILClientIL] ConnectionReceiverOILClient is connecting to: 127.0.0.2:32809
      2003-09-18 13:12:07,829 ERROR [org.jboss.mq.il.oil.OILClientIL] Cannot connect to the ConnectionReceiver/Server
      java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
      at java.net.Socket.connect(Socket.java:452)
      at java.net.Socket.connect(Socket.java:402)
      at java.net.Socket.(Socket.java:309)
      at java.net.Socket.(Socket.java:153)
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175)
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.pong(OILClientIL.java:112)
      at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.java:837)
      at org.jboss.mq.server.JMSServerInterceptorSupport.ping(JMSServerInterceptorSupport.java:308)
      at org.jboss.mq.server.TracingInterceptor.ping(TracingInterceptor.java:712)
      at org.jboss.mq.server.JMSServerInvoker.ping(JMSServerInvoker.java:310)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:324)
      at java.lang.Thread.run(Thread.java:534)
      2003-09-18 13:12:07,970 WARN [org.jboss.mq.il.oil.OILServerILService] Client request resulted in a server exception:
      org.jboss.mq.SpyJMSException: Could not pong; - nested throwable: (java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server)
      at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.java:841)
      at org.jboss.mq.server.JMSServerInterceptorSupport.ping(JMSServerInterceptorSupport.java:308)
      at org.jboss.mq.server.TracingInterceptor.ping(TracingInterceptor.java:712)
      at org.jboss.mq.server.JMSServerInvoker.ping(JMSServerInvoker.java:310)
      at org.jboss.mq.il.oil.OILServerILService$Client.run(OILServerILService.java:324)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:183)
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)
      at org.jboss.mq.il.oil.OILClientIL.pong(OILClientIL.java:112)
      at org.jboss.mq.server.JMSDestinationManager.ping(JMSDestinationManager.java:837)
      ... 5 more

      As far I can see on the log, JBoss tries to connect to 127.0.0.2:32809 (The loopback devise?). But this is not the IP address of the client. Any ideas what is going wrong?

      Regards

      Bernd

        • 1. Re: Problem with messages over a network.

          your network configuration is broken.

          try to ping 127.0.0.2 to see what's happening (in any case, this range should not be used for internal IPs)

          • 2. Re: Problem with messages over a network.
            blinso

            I already tried to ping 127.0.0.2 and I receive answers from 127.0.0.1. Btw. it is a Windows XP machine.

            I think this is correct because 127.0.0.X is the loopback device. I also tried the same ping on a linux machine and it receives answers from 127.0.0.1. As I said, I think this is O.K. for the loopback device.

            But why want JBoss send the answer to the client over the loopback device? How can I tell JBoss that it should use the right address?

            Hmm. How did JBoss find out the addresses of clients which are listening on topics? I think it will receive the address when the client subscribe to the topic, but I dont think that this is the loopback address. But how can I check this?

            Btw. access to the beans on the JBoss server works also well over the network. Only receiving message, or better sending from JBoss to the client, didn't work.

            • 3. Re: Problem with messages over a network.

              Ah ok I didn't know. Well if JBoss tries to connect on the loopback, he won't access your distant machine in any case :p

              I don't know why it occurs but I am pretty confident about a network issue. So you have jboss running on an XP machine. What OS are your running on the other machine? Can you ping client machine -> server and vice versa?

              Regards,

              Stephane

              • 4. Re: Problem with messages over a network.
                blinso

                O.K. Now I know a bit more about the problem. But now I don't know if it is really a JBoss problem.

                I think the network is configured O.K. All is running (ping, SMB, NFS, JBoss bean and JSP access) only listen on messages don't work.

                Btw. All systems runnning Java 1.4.2.

                The server, my developer machine, is a Windows XP system.

                Now I tried a Windows 2000 client and it runs perfectly.

                Before, I used a SuSE Linux 8.2 client, a laptop with PCMCIA ethernet. This client makes the problems. All clients used DHCP to get there IP addresses. I switched of the DHCP client on the SuSE machine and set a IP address manually and now it works too. I don't know why it don't work with DHCP on the SuSE machine. Maybe the problem is, that the loopback is bound before the PCMCIA network card is bound and the DHCP address is received and Java or the JBoss JMX classes than uses this address. Is ther a way to tell the Java Client to use a certain IP address as the clients JMX return address?

                O.K. I can live with this for the moment, but if someone have a idea why it don't work on Linux with DHCP client, please tell. ;-)

                • 5. Re: Problem with messages over a network.
                  stefanfreyr

                  I also had this problem but we managed to solve it.

                  The thing is that you need to remove your computer name from the /etc/hosts file.

                  JBoss seems to resolve the hostname of the client computer to its IP address on the client. So instead of sending the hostname of the client computer, it is resolving that to the ip address of the client and sending that.

                  If the clients /etc/hosts contains an entry for the computer name in the 127.0.0.1 line then the JMS server will try to connect to that IP address... which of course is the server itself.

                  So, the solution to this is to make lines in /etc/hosts that look like this:

                  127.0.0.1 localhost pandora-stfs

                  (where pandora-stfs is the hostname of the computer) to look like this:
                  127.0.0.1 localhost


                  This will result in the client either resolving his own ip address to the one that it is on the network, or sending the hostname instead of the IP (it's probably the first one that's happening though) and the server will in turn connect back to the correct JMS client.

                  Regards, Stefan.