一、错误异常
使用springboot项目代码使用redis-2.4.2-win32-win64-fix版本报错“org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR wrong number of arguments for 'set' command...Caused by: io.lettuce.core.RedisCommandExecutionException: ERR wrong number of arguments for 'set' command”错误异常,日志详情>>
org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR wrong number of arguments for 'set' command@b@ at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:54)@b@ at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:52)@b@ at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41)@b@ at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44)@b@ at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42)@b@ at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:268)@b@ at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.convertLettuceAccessException(LettuceStringCommands.java:799)@b@ at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.set(LettuceStringCommands.java:180)@b@ at org.springframework.data.redis.connection.DefaultedRedisConnection.set(DefaultedRedisConnection.java:281)@b@ at org.springframework.data.redis.cache.DefaultRedisCacheWriter.lambda$put$0(DefaultRedisCacheWriter.java:90)@b@ at org.springframework.data.redis.cache.DefaultRedisCacheWriter.execute(DefaultRedisCacheWriter.java:242)@b@ at org.springframework.data.redis.cache.DefaultRedisCacheWriter.put(DefaultRedisCacheWriter.java:87)@b@ at org.springframework.data.redis.cache.RedisCache.put(RedisCache.java:144)@b@ at com.meizhi.service.UserService.getUserById(UserService.java:99)@b@ at com.meizhi.service.UserService$$FastClassBySpringCGLIB$$68076eba.invoke(<generated>)@b@ at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)@b@ at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)@b@ at com.meizhi.service.UserService$$EnhancerBySpringCGLIB$$49acc48e.getUserById(<generated>)@b@ at com.meizhi.controller.UserController.userDetail(UserController.java:25)@b@ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)@b@ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)@b@ at java.lang.reflect.Method.invoke(Method.java:498)@b@ at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)@b@ at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)@b@ at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)@b@ at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)@b@ at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)@b@ at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)@b@ at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)@b@ at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)@b@ at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)@b@ at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)@b@ at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)@b@ at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)@b@ at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)@b@ at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)@b@ at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)@b@ at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)@b@ at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)@b@ at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)@b@ at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)@b@ at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)@b@ at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)@b@ at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:118)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)@b@ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)@b@ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)@b@ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)@b@ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)@b@ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)@b@ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)@b@ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)@b@ at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)@b@ at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)@b@ at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)@b@ at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)@b@ at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)@b@ at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)@b@ at java.lang.Thread.run(Thread.java:748)@b@Caused by: io.lettuce.core.RedisCommandExecutionException: ERR wrong number of arguments for 'set' command@b@ at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:135)@b@ at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:108)@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.CommandHandler.complete(CommandHandler.java:646)@b@ at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:604)@b@ at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:556)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)@b@ at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)@b@ at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)@b@ at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)@b@ at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)@b@ at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)@b@ at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697)@b@ at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632)@b@ at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549)@b@ at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)@b@ at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)@b@ at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)@b@ at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)@b@ ... 1 more
二、解决方法
升级redis版本,如换为Redis-x64-5.0.14版本即可解决问题