error message:
Java.net.ConnectException:Connection refused at Java.net.PlainSocketImpl.socketConnect (Native Method) At java.net.AbstractPlainSocketImpl.doConnect (abstractplainsocketimpl.java:+) at Java.net.AbstractPlainSocketImpl.connectToAddress (Abstractplainsocketimpl.java:206) at Java.net.AbstractPlainSocketImpl.connect (Abstractplainsocketimpl.java:188) at Java.net.SocksSocketImpl.connect (Sockssocketimpl.java:392) at Java.net.Socket.connect (Socket.java :589) at java.net.Socket.connect (socket.java:538) at Java.net.Socket. <init> (socket.java:434) ...
Possible causes:
- Port is occupied
- Path error
- Request Method (Get|post)
- ...
Workaround:
Here is what happens when ports are occupied, which can:
- Kill the process that occupies the port number (typically
8080 ), releasing the port;
- Shut down
Tomcat the server completely, or restart the project.
Choosing the latter is also a common approach in the absence of port collisions, which can be referenced in the following steps:
Startup and shutdown of the Tomcat server under Linux and view live print logs
Java.net.ConnectException:Connection refused anomalies