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 ...
随机推荐
- Linux 目录结构学习与简析 Part2
linux目录结构学习与简析 by:授客 QQ:1033553122 ---------------接Part 1-------------- #1.查看CPU信息 #cat /proc/cpuinf ...
- 安卓开发----TextView控件属性列表(转)
文章原地址: http://wwzcraig.blog.163.com/blog/static/64622969201373184343118/ android:autoLink设置是否当文本为URL ...
- linux上部署engineercms、docker和onlyoffice实现文档协作
等了好久,这次终于下决心在局域网部署了linux系统,并安装docker和load了onlyoffice,利用engineercms进行资料管理和文档协作. 我整理了完整文档,见我的网盘. engin ...
- Android View体系(一)视图坐标系
前言 Android View体系是界面编程的核心,他的重要性不亚于Android四大组件,在这个系列中我会陆续讲到View坐标系.View的滑动.View的事件分发等文章来逐步介绍Android V ...
- Mysql基础之 事务
MySql事务 Mysql事务主要处理操作量大,复杂度高的数据. Mysql事务需要注意的三点: 1.在mysql中只有使用innodb数据库引擎的数据库或表才支持事务 2.事务处理可以用来维护数据库 ...
- [方法提炼] 获取Android设备序列号方法
通过这个方法可以检测设备是否连接成功,如果有一台或者多台设备,可以将所有设备序列号全部输出 # -*- coding:utf-8 -*- import os def attachDeviceList( ...
- css权重 vs 浏览器渲染 -- css之弊病
昨日,突现一个bug,令人十分恼火. 基本场景 自己实现一多选日历,可多选多天(相连或不相连均可)."贵司"的需求真心有些小复杂了,"市面"上没有这样的相似的东 ...
- idea报错:[2016-08-31 09:20:10,763] Artifact xxx:war exploded: Error during artifact deployment.
[2016-08-31 09:20:10,763] Artifact newClassProject1:war exploded: Error during artifact deployment. ...
- 转://tcpdump抓包实例
基本语法 ========过滤主机--------- 抓取所有经过 eth1,目的或源地址是 192.168.1.1 的网络数据# tcpdump -i eth1 host 192.168.1.1- ...
- Java程序在Linux上运行虚拟内存耗用很大
突然集群的2个节点挂了,通过top查看, 虚拟内存22G, 通过 pmap -x 8 | grep anon 一大堆64M Linux下glibc的内存管理机制用了一个很奇妙的东西,叫arena.在g ...