首页

解决“io.lettuce.core.RedisCommandExecutionException: ERR Client sent AUTH, but no password is set”错误异常

标签:redis密码     发布时间:2023-08-06   

一、异常描述

配置redis密码(requirepass  123456)后,运行代码后报错“org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379..io.lettuce.core.RedisCommandExecutionException: ERR Client sent AUTH, but no password is set”,详情日志>>

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.@b@2023-08-13 00:43:49.768 [main] ERROR org.springframework.boot.SpringApplication:821 - Application run failed@b@org.springframework.context.ApplicationContextException: Failed to start bean 'redisContainer'; nested exception is org.springframework.data.redis.listener.adapter.RedisListenerExecutionFailedException: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379@b@	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)@b@	at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)@b@	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)@b@	at java.lang.Iterable.forEach(Iterable.java:75)@b@	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)@b@	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)@b@	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:937)@b@	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)@b@	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)@b@	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)@b@	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)@b@	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)@b@	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)@b@	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)@b@	at org.jeecg.JeecgSystemApplication.main(JeecgSystemApplication.java:31)@b@Caused by: org.springframework.data.redis.listener.adapter.RedisListenerExecutionFailedException: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379@b@	at org.springframework.data.redis.listener.RedisMessageListenerContainer.lazyListen(RedisMessageListenerContainer.java:275)@b@	at org.springframework.data.redis.listener.RedisMessageListenerContainer.start(RedisMessageListenerContainer.java:249)@b@	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)@b@	... 14 common frames omitted@b@Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1689)@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1597)@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1383)@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1366)@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1093)@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:421)@b@	at org.springframework.data.redis.listener.RedisMessageListenerContainer$Subscriber.initialize(RedisMessageListenerContainer.java:1186)@b@	at org.springframework.data.redis.listener.RedisMessageListenerContainer.doSubscribe(RedisMessageListenerContainer.java:318)@b@	at org.springframework.data.redis.listener.RedisMessageListenerContainer.lazyListen(RedisMessageListenerContainer.java:295)@b@	at org.springframework.data.redis.listener.RedisMessageListenerContainer.lazyListen(RedisMessageListenerContainer.java:265)@b@	... 16 common frames omitted@b@Caused by: org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379@b@	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:109)@b@	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1595)@b@	... 24 common frames omitted@b@Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379@b@	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78)@b@	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)@b@	at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:330)@b@	at io.lettuce.core.RedisClient.connect(RedisClient.java:216)@b@	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115)@b@	at java.util.Optional.orElseGet(Optional.java:267)@b@	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115)@b@	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$null$0(LettucePoolingConnectionProvider.java:97)@b@	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:211)@b@	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:201)@b@	at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:70)@b@	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571)@b@	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298)@b@	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223)@b@	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:122)@b@	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:117)@b@	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:103)@b@	... 25 common frames omitted@b@Caused by: io.lettuce.core.RedisCommandExecutionException: ERR Client sent AUTH, but no password is set@b@	at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147)@b@	at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116)@b@	at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120)@b@	at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111)@b@	at io.lettuce.core.protocol.CommandWrapper.complete(CommandWrapper.java:63)@b@	at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:747)@b@	at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:682)@b@	at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:599)@b@	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)@b@	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)@b@	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)@b@	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)@b@	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)@b@	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)@b@	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)@b@	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)@b@	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)@b@	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)@b@	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)@b@	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)@b@	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)@b@	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)@b@	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)@b@	at java.lang.Thread.run(Thread.java:748)

解决“io.lettuce.core.RedisCommandExecutionException: ERR Client sent AUTH, but no password is set”错误异常

二、解决方法

1)配置redis.conf或redis.windows.conf密码后

#requirepass @b@requirepass  123456

2) 不能直接运行redis-server.exe,需要关联配置文件运行,如“redis-server.exe  redis.conf” ,可以编辑如下redisStart.bat文件内容

@echo off@b@title "redis start2"@b@cd .@b@redis-server.exe  redis.conf@b@@pause

3)测试结果如下,运行redis-cli.exe,即ok

解决“io.lettuce.core.RedisCommandExecutionException: ERR Client sent AUTH, but no password is set”错误异常

  • <<相关内容>>
<<热门下载>>