Tag Archives: Caused by: java.net.SocketTimeoutException: connect timed out

[How to Solve] Caused by: java.net.SocketTimeoutException: connect timed out

An error was encountered during deployment, as follows:

java.net.SocketTimeoutException: connect timed out
    at redis.clients.jedis.Connection.connect(Connection.java:)
    at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:)
    at redis.clients.jedis.Connection.sendCommand(Connection.java:)
    at redis.clients.jedis.Connection.sendCommand(Connection.java:)
    at redis.clients.jedis.BinaryClient.multi(BinaryClient.java:)
    at redis.clients.jedis.BinaryJedis.multi(BinaryJedis.java:)
    at cn.edu.aynu.redis.TestTx.main(TestTx.java:)
Caused by: java.net.SocketTimeoutException: connect timed out
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:)
    at java.net.Socket.connect(Socket.java:)
    at redis.clients.jedis.Connection.connect(Connection.java:)
    ... more

This is actually a redis connection error, not a database connection error, the database connection error is this: jdbc connection refused

There are many specific reasons, such as: wrong ip, port not open, ip cannot be pinged and not allowed to access, etc.

I am here because the server ip cannot be pinged, it can be solved by releasing it in the security group.