user2279895
user2279895

Reputation:

java.rmi.ConnectException: Connection refused to host:

  java.rmi.ConnectException: Connection refused to host: IPSERVER0.0.0.0.0; nested exception     is: 
java.net.ConnectException: Connection timed out
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
at StartRMI.go(StartRMI.java:14)
at StartRMI.main(StartRMI.java:6)
    Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 7 more

I get this exception when I try to connect a remote client to my server. My Server is running RMI Server fine, and there no firewall installed. How to fix that issue ?

Upvotes: 3

Views: 24655

Answers (4)

Ysr Shk
Ysr Shk

Reputation: 224

Try to start the RMI registry using

start rmiregistry 

for default port or

rmiregistry <port_no> 

for a specified port.

Upvotes: 0

Daniel Wondyifraw
Daniel Wondyifraw

Reputation: 7713

Check all you network adapters ,some time a VM network adapter interferes in this way . Which is you current localhost or 127.0.0.1 is not any more referring to you host name or current machine ,which then create a connection refused problem. My General Recommendation is:

1.To check or disable unwanted VM or Network Adapters

2.Ping 127.0.0.1

3.Disable Firewall and Test if all the above doesn't work 

4.Add security Manager with a policy file on you server if you haven't done that.

Upvotes: 2

SSaikia_JtheRocker
SSaikia_JtheRocker

Reputation: 5063

Is IPSERVER mapped in /etc/hosts file to the IP address you want? Check what you get when you do a hostname -i or hostname.

Try putting your IP address instead of the domain name.

Upvotes: 0

Juned Ahsan
Juned Ahsan

Reputation: 68715

You have not mentioned which OS you are using, if everything is correct in terms of code and firewall then you may need to check the host entries or ip table rules.

Upvotes: 0

Related Questions