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高可靠技术
1.进程挂死时,有后台监控程序检测重新拉起. 2.进程占用系统资源超过ulimit限定的资源时,会被ulimit杀死,同时配合后台监控程序,重新拉起进程,实现进程可靠性. 3.Linux系统的高可靠性 ...
- JavaScript大杂烩0 - WEB基础知识
1. 协议小结:HTTP协议与TCP/IP协议 现代Web应用开发的基础是HTTP协议,那么HTTP协议与我们熟知的TCP/IP协议有什么关系呢? 这个要从网络通信模型说起,简单的说,计算机通信就像两 ...
- 简述 Spring Cloud 是什么1
很多同学都了解了Spring ,了解了 Spring Boot, 但对于 Spring Cloud 是什么还是比较懵逼的. 本文带你简单的了解下,什么是Spring Cloud. Spring Clo ...
- [20171120]11G关闭直接路径读.txt
[20171120]11G关闭直接路径读.txt --//今天做filesystemio_options参数测试时,遇到一个关于直接路径读的问题.--//如果看以前的博客介绍,设置"_ser ...
- SQLSERVER 死锁
select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tra ...
- c#中//注释和///注释的区别
c#中//注释和///注释的区别 ///会被编译,//不会所以使用///会减慢编译的速度(但不会影响执行速度)///会在其它的人调用你的代码时提供智能感知 也是一种注释,但是这种注释主要有两种作用:1 ...
- LNMP环境搭建详细教程
之前有一篇博客写的是LAMP的环境搭建,今天来详细介绍一下另外一个模式——LNMP=Linux+Nginx+MySQL+PHP. 一.在Linux系统下nginx的安装过程,先到http://ngin ...
- 移除元素的golang实现
给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度. 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成 ...
- Hadoop优化 第一篇 : HDFS/MapReduce
比较惭愧,博客很久(半年)没更新了.最近也自己搭了个博客,wordpress玩的还不是很熟,感兴趣的朋友可以多多交流哈!地址是:http://www.leocook.org/ 另外,我建了个QQ群:3 ...
- php 对象教程
[PHP面向对象(OOP)编程入门教程]6.如何去使用对象中的成员 作者:qianyunlai.com 发布于:2012-05-19 15:02 分类:PHP基础 浏览(280) 上面看到PHP ...