Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource
我们在SpringBoot中用Jedis来访问Redis,其中Redis是采用集群(单机没有本篇文章的问题)的方式,在启用Redis的时候碰到如上问题。
错误的核心信息如下:
Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource
完整信息如下:
// 下午4:: . ____ _ __ _ _
// 下午4:: /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
// 下午4::( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
// 下午4:: \\/ ___)| |_)| | | | | || (_| | ) ) ) )
// 下午4:: ' |____| .__|_| |_|_| |_\__, | / / / /
// 下午4:: =========|_|==============|___/=/_/_/_/
// 下午4:: :: Spring Boot :: (v1.5.1.RELEASE)
// 下午4::
// 下午4::40Nov , :: PM com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig readBoolean
// 下午4::40INFO: profiler.jdk.http.param=true
// 下午4::40Nov , :: PM com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig readBoolean
// 下午4::40INFO: profiler.jdk.http.param=true
// 下午4::40Nov , :: PM com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig readBoolean
// 下午4::40INFO: profiler.jdk.http.param=true
// 下午4::52org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
// 下午4:: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:)
// 下午4:: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:)
// 下午4:: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:)
// 下午4:: at org.springframework.beans.factory.support.AbstractBeanFactory$.getObject(AbstractBeanFactory.java:)
// 下午4:: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:)
// 下午4:: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:)
// 下午4:: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:)
// 下午4:: at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:)
// 下午4:: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:)
// 下午4:: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
// 下午4:: at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:)
// 下午4:: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:)
// 下午4:: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:)
// 下午4:: at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
// 下午4:: at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
// 下午4:: at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
// 下午4:: at com.zte.Application.main(Application.java:)
// 下午4:: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
// 下午4:: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
// 下午4:: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
// 下午4:: at java.lang.reflect.Method.invoke(Method.java:)
// 下午4:: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:)
// 下午4:: at org.springframework.boot.loader.Launcher.launch(Launcher.java:)
// 下午4:: at org.springframework.boot.loader.Launcher.launch(Launcher.java:)
// 下午4:: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:)
// 下午4::52Caused by: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
// 下午4:: at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.fetchJedisConnector(JedisConnectionFactory.java:)
// 下午4:: at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.getConnection(JedisConnectionFactory.java:)
// 下午4:: at org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration$EnableRedisKeyspaceNotifica
经查找,在Java代码中,我们使用了注解:@EnableRedisHttpSession,这个注解是用来开启Redis来集式式管理Session。
而在使用这种方式的时候,是需要Redis开启Keyspace Notifications功能的,默认是关闭的。
这个功能有一个参数来控制它,notify-keyspace-events,值为Egx。
可以通过在Redis.Config中配置。
也可以通过命令行来配置,如下所示:
redis-cli config set notify-keyspace-events Egx
然后重启Redis生效。
参考文档:
https://docs.spring.io/spring-session/docs/current/reference/html5/#api-redisoperationssessionrepository-sessiondestroyedevent
http://blog.csdn.net/xiaoyu411502/article/details/51248980
Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource的更多相关文章
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; neste
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r ...
- MyBatis笔记----报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ij34/mybatis/applicationContext.xml]: Invocation of init method failed; nested exception is org.sp
四月 05, 2017 4:51:02 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRef ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined ...
- aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method fai
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDaoImpl' ...
- Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable t
spring与hibernate整合然后出现如下错误: org.springframework.beans.factory.BeanCreationException: Error creating ...
- Spring AOP 报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXXXX' defined in class path resource..........
完整报错如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'befo ...
- Error creating bean with name 'us' defined in class path resource [com/liuyang/test/DI/beans2.xml]: Cannot resolve reference to bean 'daoa' while setting bean property 'daoa'; nested exception is org.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'us' defined ...
- Error creating bean with name 'mapper' defined in class path resource [applicationcontext.xml]: Cannot resolve reference to bean 'factory' while setting bean property 'sqlSessionFactory'; nested excep
Error creating bean with name 'mapper' defined in class path resource [applicationcontext.xml]: Cann ...
随机推荐
- Android系统启动流程(二)解析Zygote进程启动过程
1.Zygote简介 在Android系统中,DVM(Dalvik虚拟机).应用程序进程以及运行系统的关键服务的SystemServer进程都是由Zygote进程来创建的,我们也将它称为孵化器.它通过 ...
- 【redis专题(2)】命令语法介绍之string
REDIS有5大数据结构:string,link,sortedset,sets,hash. 这5个结构我将用5篇文章来记录各自是怎么用的,然后再用一篇文章来说一下各自的应用场景: 更多语法请参考: h ...
- 09-OpenLDAP加密传输配置
OpenLDAP加密传输配置(CA服务器与openldap服务器异机) 阅读视图 环境准备 CA证书服务器搭建 OpenLDAP服务端与CA集成 OpenLDAP客户端配置 客户端测试验证 故障处理 ...
- Excel的快速录入
数据有效性: 1.选择要限制数据有效性的区域: 2.点开[数据]选项卡选择”数据验证“: 3.[设置]中选择”序列": 4.若手动输入则需要将内容使用英文符号分割开来(比如:A级,B级): ...
- python第九天----今天来晚了!
作业 1. HAproxy配置文件操作1. 根据用户输入输出对应的backend下的server信息2. 可添加backend 和sever信息3. 可修改backend 和sever信息4. 可删除 ...
- 常用css字体英文写法
font-family: 'Microsoft Yahei',sans-serif; 宋体:SimSun 黑体:SimHei
- 使用 WebStorm IDE 调试 Pomelo 应用程序
使用得心应手的IDE来开发应用程序,可以使我们的工作事半功倍.而调试则更可以让我们准确的定位BUG,发现问题.本文讲述如何使用 WebStorm 这个怪兽级JavaScript IDE来调试 Chat ...
- 华硕200系主板完美兼容M.2安装Win7系统
虽然Windows 10系统的装机率正不断攀升,但经典的Windows 7依然有着大量的用户群体.特别是在我们中国, Windows 7依然是许许多多电脑用户的装机首选系统. 经久不衰的Windows ...
- 【转】handbrake使用教程
原文地址http://tieba.baidu.com/p/2399590151?pn=1 现在的很多压制教程基本都是使用megui或者mediacoder的,这两个软件使 ...
- SAP CRM 自定义控制器与数据绑定
当用户从视图离开时,视图将失去它的数据.解决这个问题,需要引入自定义控制器(Custom Controller)(译者注:SAP CRM自定义端中,不同地方的Custom Controller会翻译为 ...