当前位置:   article > 正文

redis.clients.jedis.exceptions.JedisDataException: ERR unknown command ' config '_caused by: redis.clients.jedis.exceptions.jedisdat

caused by: redis.clients.jedis.exceptions.jedisdataexception: err unknown co

redis.clients.jedis.exceptions.JedisDataException: ERR unknown command ’ config ’

最近将公司私有云中的微服务项目迁移到腾讯云中,在本地调试一直正常,但是将本地redis修改为腾讯云的redis之后就报这个异常。

完整错误信息如下

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/boot/autoconfigure/session/RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: ERR unknown command ' config '; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR unknown command ' config '
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar!/:2.0.4.RELEASE]
        at com.huajie.ZJiaoMobileServer.main(ZJiaoMobileServer.java:28) [classes!/:1.0]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_221]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_221]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_221]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [eval-zjiaomobile-1.0.jar:1.0]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [eval-zjiaomobile-1.0.jar:1.0]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [eval-zjiaomobile-1.0.jar:1.0]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [eval-zjiaomobile-1.0.jar:1.0]
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: ERR unknown command ' config '; nested exception is redis.clients.jedis.exceptions.JedisDataException: ERR unknown command ' config '
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:64) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:41) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:181) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.connection.jedis.JedisServerCommands.convertJedisAccessException(JedisServerCommands.java:531) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.connection.jedis.JedisServerCommands.setConfig(JedisServerCommands.java:324) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.data.redis.connection.DefaultedRedisConnection.setConfig(DefaultedRedisConnection.java:1126) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        at org.springframework.session.data.redis.config.ConfigureNotifyKeyspaceEventsAction.configure(ConfigureNotifyKeyspaceEventsAction.java:70) ~[spring-session-data-redis-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration$EnableRedisKeyspaceNotificationsInitializer.afterPropertiesSet(RedisHttpSessionConfiguration.java:286) ~[spring-session-data-redis-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
        ... 24 common frames omitted
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR unknown command ' config '
        at redis.clients.jedis.Protocol.processError(Protocol.java:127) ~[jedis-2.9.0.jar!/:na]
        at redis.clients.jedis.Protocol.process(Protocol.java:161) ~[jedis-2.9.0.jar!/:na]
        at redis.clients.jedis.Protocol.read(Protocol.java:215) ~[jedis-2.9.0.jar!/:na]
        at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) ~[jedis-2.9.0.jar!/:na]
        at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239) ~[jedis-2.9.0.jar!/:na]
        at redis.clients.jedis.Jedis.configSet(Jedis.java:2664) ~[jedis-2.9.0.jar!/:na]
        at org.springframework.data.redis.connection.jedis.JedisServerCommands.setConfig(JedisServerCommands.java:322) ~[spring-data-redis-2.0.9.RELEASE.jar!/:2.0.9.RELEASE]
        ... 29 common frames omitted
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49

关键信息

  • Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR unknown command ’ config ’
  • RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.class

原因如下

  1. redis本地版本是3.2,而腾讯云redis是2.8,但是又不可能去升级腾讯云的版本

  2. 异常类RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.class中的RedisSession

系统中最早的版本用redis做session的共享,但是后面session这一块共享功能是自己手动开发,并没有采用开源的组件。

解决方法:

注释掉spring-session-data-redis相关的jar依赖即可
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/739379
推荐阅读
相关标签
  

闽ICP备14008679号