How to Fix java.net.ConnectException
java.net.ConnectException means the connection to the server failed. What refused, timed out, getsockopt and no further information mean, and what to check.
Quick Fix
Check that the server is running on the address and port you use, then look at the firewall and port forwarding if it still fails.
Error Message
java.net.ConnectException: Connection refused: no further informationHow to Fix
Start the server and wait for Done in the console before connecting.
Check server-port in server.properties and put that port after a colon in the address.
Allow TCP on that port in the server machine's firewall.
For a home server, forward the port on your router to the server's local IP address.
Connect with the numeric IP address once to rule out an old DNS record.
Common Causes
- Connection refused: the machine answered, but nothing listens on that port, because the server is off, crashed or uses another server-port.
- Connection timed out: no answer came back, for example because a firewall drops the connection or the IP address is wrong.
- The server runs at home without port forwarding, so it works on your own network but not from outside.
- The host name still points to an old IP address after the server moved.
Diagnostic Steps
- Verify the server is running.
- Check the address and server-port.
- Check the firewall for TCP on that port.
- Check port forwarding for a home server.
FAQ
How do I test if my port is forwarded?
Have someone outside your network connect to your public IP address and port while the server runs. A port checker website also works, but only while the server is running.
What do no further information and getsockopt mean?
Both come from Java on Windows. Java 8 ends the message with no further information, while Java 21 and Java 25 end it with getsockopt, the call that reported the error. Connection refused or Connection timed out is the part that matters.
Is this a problem with Java?
No. Java only reports that the connection failed. The cause is the server, the port or the network in between.
Related Errors
How to Fix Connection Refused
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused
How to Fix Connection Timed Out
io.netty.channel.ConnectTimeoutException: connection timed out
How to Fix io.netty.channel.AbstractChannel Error
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: getsockopt: mc.example.com/203.0.113.10:25565
How to Fix Unable to Resolve Hostname
Can't resolve hostname / Unknown host