JedisConnectionException: Failed connecting to host localhost:6379
报错原因:没有启动服务,打开服务即可
redis.clients.jedis.exceptions.JedisConnectionException:
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Failed connecting to host localhost:6379
at redis.clients.jedis.Connection.connect(Connection.java:204)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:100)
at redis.clients.jedis.Connection.sendCommand(Connection.java:125)
at redis.clients.jedis.Connection.sendCommand(Connection.java:120)
at redis.clients.jedis.BinaryClient.ping(BinaryClient.java:113)
at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:186)
at com.wbg.mr.test.Main.main(Main.java:11)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at redis.clients.jedis.Connection.connect(Connection.java:181)
... 6 more