How to solve java.net.ConnectException: Connection timed out: connect

Problem Description:

 

Solutions:

That is, there must be four lines above configuration errors, some students may read it several times here, no error is found, but there most likely is actually your ip address has changed, I just changed the net, looking for a long error did not find his way several times to check the database user name and password are correct, check the ip of ignoring.

 

A little bit of Harvest: middle of the meal blind operation, and finally found just use @Resource or @Autowired the corresponding spring proxy management serviceImpl objects will error, that is a call to service layer method on the error, but run previously written old the code does not error, because the former are not written in written localhost ip, if direct private XxxService xxxServiceImpl = new xxxServiceImpl () ;, that is, do not use the service instance spring control management, it does not complain Conclusion: this times for the wrong reasons or underlying initialization and configuration files are not familiar with their own effect, but know that the database configuration files only the first initialized when calling the service layer method, if not, it will be a start tomcat error.

 

Guess you like

Origin www.cnblogs.com/darkclouds/p/11118975.html