Skip to main content
warningConnection ErrorsAffects: Java Edition

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 information

How to Fix

1

Start the server and wait for Done in the console before connecting.

2

Check server-port in server.properties and put that port after a colon in the address.

3

Allow TCP on that port in the server machine's firewall.

4

For a home server, forward the port on your router to the server's local IP address.

5

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

  1. Verify the server is running.
  2. Check the address and server-port.
  3. Check the firewall for TCP on that port.
  4. 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

Need More Help?