Error Stack:
Org. springframework. remoting. remoteconnectfailureexception: cannot connect to remote service [RMI: // 192.168.2.61/service]; Nested exception is Java. RMI. connectexception: Connection refused to host: 192.168.7.11; Nested exception is:
Java.net. connectexception: Connection timed out: connect
It is strange that the URL accessed by RMI is correct, but the IP address obtained from subsequent access is inaccessible from another of the dual-nic.
Perform a simple test on the local machine:
System. Out. println (unicastremoteobject. exportobject (new remote () {}, 0 ));
Output:
Proxy [remote, remoteobjectinvocationhandler [unicastref [liveref: [endpoint: [192.168.2.3: 2339] (local), objid: [0]
It indicates that the IP address of the object has been determined when it is not registered. After it is bound, the client will follow this IP address as shown in the figure below. There are two NICs on the server. If you find one, it will be over.
This method is useful for Distributed Object Registration, but it is relatively retarded when multiple IP addresses are involved. Sun's FAQ provides a simple answer:
Http://java.sun.com/j2se/1.5.0/docs/guide/rmi/faq.html#netmultihomed
One sentence:
System. setproperty ("Java. RMI. server. hostname", "192.168.2.3"); // we recommend that you load data from the configuration file.