java.net.ConnectException: Connection refused

自古美人都是妖i 提交于 2019-11-28 14:38:27
The Well

java.net.ConnectException: Connection refused means that the IP address or port number you've entered is incorrect!

There is nothing listening at that IP:port. Check that the IP:port is correct, that MySQL is installed there, on that port, and that it is running.

Contrary to other answers here, it has nothing to do with the user name, password, or permissions, and almost certainly nothing to do with the firewall either unless you have an antique.

In general, when you are getting java.net.ConnectException: Connection refused often it is because of the following reasons:

  1. The server is not started. What happens when you ping the host or try to access the host from you browser? Maybe there is a spelling error in the hostname of your project.
  2. Your firewall is blocking access. Disable you firewall and try again
  3. You are using the wrong port. If you have access to the server see what port it is configured with and that your client connection params match.
  4. You have not configured SSL. Is the endpoint using https? This is more specific to connecting web services rather than databases, but if you are not handling certs correctly you will get a connection refused error.

I've found the solution for the problem. My server was not listening to connections over the port 3306 and I made necessary configurations

Thank you all

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!