場景描述
springboot項目用redis解決session共享問題,啟動項目報錯。
springboot版本:
org.springframework.boot
spring-boot-starter-parent
1.5.19.RELEASE
redis版本
[15332] 12 Mar 15:59:54.307 # Server started, Redis version 2.6.12
[15332] 12 Mar 15:59:54.308 * The server is now ready to accept connections on port 6379
異常原因
redis服務器版本和jar包版本不一致造成的
maven倉庫的 spring-boot-starter-redis1.3.8的只支持2.7.3 的redis
解決方案
更換redis服務器版本為springboot兼容的版本。這里更換為3.0。
[25072] 12 Mar 16:01:52.065 # Server started, Redis version 3.0.501
[25072] 12 Mar 16:01:52.065 * The server is now ready to accept connections on port 6379
————————————————
版權聲明:本文為CSDN博主「清歡ysy」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_33840251/article/details/88707803
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_181]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[?:1.8.0_181]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:327) ~[netty-transport-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:616) ~[netty-transport-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563) ~[netty-transport-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480) ~[netty-transport-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) ~[netty-transport-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar!/:4.1.29.Final]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_181]