`

redis创建bean异常

 
阅读更多
严重: Exception sending context initialized event to listener instance of class com.travelsky.aesw.framework.AESWServletContextListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sentinelConfiguration' defined in class path resource [AESW_applicationContext_redis.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sentinels' of bean class [org.springframework.data.redis.connection.RedisSentinelConfiguration]: Bean property 'sentinels' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
	at com.travelsky.aesw.framework.sysutil.ManagerFactory.getContext(ManagerFactory.java:67)
	at com.travelsky.aesw.framework.sysutil.ManagerFactory.initContext(ManagerFactory.java:88)
	at com.travelsky.aesw.framework.AESWServletContextListener.contextInitialized(AESWServletContextListener.java:21)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sentinels' of bean class [org.springframework.data.redis.connection.RedisSentinelConfiguration]: Bean property 'sentinels' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1052)
	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:921)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
	... 25 more




解决办法:spring版本问题,原来用的是spring3.0.6 ;最后用的是spring3.2.5 + spring-data-redis 1.4+ Jedis2.6.2

需要删掉这个jar
org.springframework.asm-3.0.6.RELEASE

其他用到的jar



  • 大小: 5.4 KB
分享到:
评论

相关推荐

    解决Spring session(redis存储方式)监听导致创建大量redisMessageListenerContailner-X线程问题

    在本文中,我们主要探讨了在使用Spring Session以及Redis作为存储方式时,由于消息监听导致创建大量线程的问题及其解决方案。我们将从Spring Session的基础知识、Redis在Spring Session中的作用、监听机制导致线程...

    spring + redis + sentinel 配置

    定期检查Sentinel的日志,确保其能正确监控Redis实例并处理任何异常情况。 总结来说,这个配置文件组合提供了Spring应用与Redis Sentinel集成的基础,实现了对Redis的高可用访问。这种配置模式在大型分布式系统中尤...

    ssm集成redis和shiro

    3. **创建RedisTemplate**: 通过Spring Bean配置,创建一个RedisTemplate实例,用于执行Redis的操作,如设置、获取、删除键值对。 4. **使用Redis**: 在业务代码中,通过@Autowired注解注入RedisTemplate,实现数据...

    ssm框架集成redis

    4. **编写Redis操作的Service**:在业务层,我们可以创建一个RedisService,通过@Autowired注解注入RedisTemplate,然后实现各种对Redis的操作,如存取数据、设置过期时间等。 ```java @Service public class ...

    在Spring体系中使用redis.spring集成redis缓存

    3. **创建RedisTemplate**:基于连接工厂创建`RedisTemplate`,它提供了操作Redis的模板方法。 ```xml &lt;bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"&gt; &lt;!-- 可选配置,...

    Spring集成redis集群

    综上所述,Spring集成Redis集群需要配置集群节点信息、创建ConnectionFactory并设置RedisTemplate,然后就可以在Spring应用中正常使用Redis集群了。在实际应用中,还需要考虑数据分布策略、故障恢复和监控等问题,以...

    Spring Boot整合redis

    Spring Boot会自动配置`RedisConnectionFactory`,但为了自定义`RedisTemplate`,可以在配置类中创建一个@Bean: ```java @Configuration public class RedisConfig { @Bean public RedisTemplate, Object&gt; ...

    Spring Redis缓存实例

    1. **创建RedisTemplate**: 可以自定义`RedisTemplate`以进行更复杂的Redis操作,如设置超时时间、序列化方式等。 2. **在业务代码中使用缓存**: 通过`@Cacheable`、`@CacheEvict`等注解标记方法,实现自动缓存和...

    spring整合redis哨兵源码

    总结来说,Spring整合Redis哨兵模式涉及了Spring Boot的配置、哨兵系统的理解、连接工厂的创建、数据序列化、CRUD操作以及异常处理等多个知识点。通过这样的整合,我们可以构建出高可用、容错性强的Redis服务,为...

    java redis demo

    在Java开发中,Redis是一个非常流行的高性能、内存数据结构存储系统,...开发者可以通过阅读源代码,了解具体的实现细节,比如序列化策略、连接池配置以及异常处理等方面的知识,进一步提升自己的Java和Redis应用能力。

    springboot版本redis分布式锁.zip

    2. 创建RedisTemplate配置:通过@Bean注解创建一个RedisTemplate实例,设置序列化方式(推荐使用StringRedisSerializer)和Key的过期时间,以防止锁被意外持有。 3. 实现分布式锁:创建一个分布式锁服务类,提供...

    使用maven简单搭建Spring mvc + redis缓存

    &lt;bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"&gt; &lt;/bean&gt; &lt;bean id="redisTemplate" class="org.springframework.data.redis.core....

    springboot-mybatis-mysql-redis demo.zip

    SpringBoot会自动创建DataSource并注入到Bean中,方便我们在代码中使用。 四、Redis缓存集成 Redis作为高性能的Key-Value数据存储系统,适用于高速读写场景,常被用作缓存。在SpringBoot项目中,我们可以引入`...

    ssm+redis的增删改查的demo.zip

    这个示例项目可以帮助开发者理解如何在实际项目中设置SSM+Redis的环境,进行数据操作,以及如何在出现异常时保持数据的一致性。通过研究和运行这个demo,开发者可以更好地掌握这些技术的整合使用。

    Spring Boot Redis 实现分布式锁的方法详解.docx

    4. 锁的异常处理:需要捕获并处理在获取和释放锁过程中可能出现的异常,例如 Redis 连接问题。 通过以上内容,你应该了解了如何使用 Spring Boot 和 Redis 实现分布式锁的基本方法。在实际开发中,可以根据具体需求...

    redis 保存session信息源码

    2. 创建Session存储适配器:创建一个适配器类,负责与Redis交互,实现Session的存取操作。 3. 将Session数据序列化:在将Session数据存入Redis之前,需要将其序列化为字符串,常见的序列化方式有JSON或自定义格式。 ...

    基于Springboot+Mybatis+ SpringMvc+springsecrity+Redis完整网站后台管理系统

    job集群:创建job、取消job、查询job、下拉搜索spring bean 数据源监控:druid 接口swagger文档 日志查询 邮件管理:发送邮件、搜索邮件 文件管理:上传文件、文件列表、文件删除 公告管理:公告未读提醒、...

    JAVA开发之redis开发示例

    2. **创建RedisTemplate**:Spring Data Redis提供了一个`RedisTemplate`类,它是操作Redis的主要接口。配置如下: ```xml &lt;bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"&gt; ...

    SSM框架 + redis + 富文本编辑器

    它简化了Java EE应用的开发,通过IoC容器管理和装配Bean,使得代码更加灵活和解耦。 SpringMVC是Spring框架的一个模块,专用于构建Web应用的模型-视图-控制器(MVC)架构。它提供了请求分发、模型绑定、数据验证...

    Redis分布式锁代码示例

    接下来,我们需要创建一个RedisTemplate bean,以便于操作Redis: ```java @Configuration public class RedisConfig { @Bean public RedisConnectionFactory redisConnectionFactory() { ...

Global site tag (gtag.js) - Google Analytics