Common network connection error occurred and the cause

1. java.net.ConnectException: Connection refused: connect

1) port number is occupied: Kill the occupation process port number (typically 8080), the release port; Tomcat server is completely shut down, or restart the project.

2) Use the following command to check the maximum number of server processes allowed: ulimit -u. If this value is set to a lower value, e.g. 1024, the following values ​​are used to increase or unrestricted 131072: ulimit -u 131072 or ulimit -u unlimited.

3) the client and server, any one or two of them are not in the network.
They may not be connected to a LAN or the Internet or any other network, in this case, Java will be thrown
client "java.net.ConnectException: Connection refused" exception.

4) server is not running with
the server is down but not running. In this case, you will get java.net.ConnectException: Connection refused errors. You can ping to check whether the server is running and listening ports.

5) The server is running but not listening port, the client is attempting to connect.
The server is running but is listening on a different port. Verify the configuration. If you are dealing with a large project, and there is a hierarchical configuration file, it may be the default configuration settings or some other covering your correct settings.

6) host ports using a firewall does not allow a combination of
almost every corporate networks are protected by a firewall. If you are connecting to a network of other companies, such as any electronic trading system, the need to increase the firewall
request of the parties to ensure that they allow each other's IP address and port number. If the firewall does not allow connection, you will also receive the same java.net.ConnectException: connect Java applications refused exception.

7) host port combination is incorrect.
Host port combination is incorrect, or earlier host port combination server has changed. Check the latest client and server-side configuration.

8) the connection string Incorrect protocol

TCP protocol is the basis for many advanced protocols, including HTTP, RMI and so on. By the time the connection string, you need to make sure you pass the correct protocol, server expects. For example, the server has been exposed, rather than by RMI connection strings services should rmi: // at the beginning.

2. org.apache.http.NoHttpResponseException

In some cases, typically at high load, web server may be able to receive a request, but does not process them. Lack of sufficient resources (such as worker threads) is a good example. This may lead to break the connection to the server in the client without giving any response. HttpClient NoHttpResponseException thrown in the face of such a situation. In most cases, retry failed NoHttpResponseException use is safe.

Guess you like

Origin blog.csdn.net/sa19861211/article/details/90714424