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)
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)
Caused by: java.rmi.RemoteException: Cannot connect to the ConnectionReceiver/Server
... 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?
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)
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.
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?
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. ;-)
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:
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.