项目中需要用到缓存,经过比较后,选择了redis,客户端使用jedis连接,也使用到了spring提供的spring-data-redis。配置正确后启动tomcat,发现如下异常:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTemplate' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: Bad type on operand stack

Exception Details:

Location:

org/springframework/data/redis/connection/jedis/JedisConnectionFactory.afterPropertiesSet()V @109: invokespecial

Reason:

Type 'redis/clients/jedis/JedisPoolConfig' (current frame, stack[3]) is not assignable to 'org/apache/commons/pool2/impl/GenericObjectPoolConfig'

Current Frame:

bci: @109

flags: { }

locals: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory' }

stack: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory', uninitialized 73, uninitialized 73, 'redis/clients/jedis/JedisPoolConfig', 'java/lang/String', integer, integer, 'java/lang/String' }

Bytecode:

0000000: 2ab4 000d c700 3d2a bb00 1759 2ab4 0003

0000010: 2ab4 0004 b700 18b5 000d 2ab4 0019 b800

0000020: 1a99 000e 2ab4 000d 2ab4 0019 b600 1b2a

0000030: b400 059e 000e 2ab4 000d 2ab4 0005 b600

0000040: 1c2a b400 0699 002e 2abb 001d 592a b400

0000050: 0a2a b400 0db6 001e 2ab4 000d b600 1f2a

0000060: b400 0db6 0020 2ab4 000d b600 21b7 0022

0000070: b500 07b1

Stackmap Table:

same_frame(@47)

same_frame(@65)

same_frame(@115)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550)

at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:150)

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)

at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)

... 39 more

Caused by: java.lang.VerifyError: Bad type on operand stack

Exception Details:

Location:

org/springframework/data/redis/connection/jedis/JedisConnectionFactory.afterPropertiesSet()V @109: invokespecial

Reason:

Type 'redis/clients/jedis/JedisPoolConfig' (current frame, stack[3]) is not assignable to 'org/apache/commons/pool2/impl/GenericObjectPoolConfig'

Current Frame:

bci: @109

flags: { }

locals: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory' }

stack: { 'org/springframework/data/redis/connection/jedis/JedisConnectionFactory', uninitialized 73, uninitialized 73, 'redis/clients/jedis/JedisPoolConfig', 'java/lang/String', integer, integer, 'java/lang/String' }

Bytecode:

0000000: 2ab4 000d c700 3d2a bb00 1759 2ab4 0003

0000010: 2ab4 0004 b700 18b5 000d 2ab4 0019 b800

0000020: 1a99 000e 2ab4 000d 2ab4 0019 b600 1b2a

0000030: b400 059e 000e 2ab4 000d 2ab4 0005 b600

0000040: 1c2a b400 0699 002e 2abb 001d 592a b400

0000050: 0a2a b400 0db6 001e 2ab4 000d b600 1f2a

0000060: b400 0db6 0020 2ab4 000d b600 21b7 0022

0000070: b500 07b1

Stackmap Table:

same_frame(@47)

same_frame(@65)

same_frame(@115)

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)

at java.lang.Class.getDeclaredConstructors(Class.java:1901)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:230)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:972)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:945)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:323)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

... 50 more

非常奇怪,由于google的访问限制,百度了半天也没什么结果,我就知道google一定可以的,果断FQ搜索,果然没有让我失望,

google结果链接:http://stackoverflow.com/questions/22704518/jedispoolconfig-is-not-assignable-to-genericobjectpoolconfig

看情况应该是jar包版本问题,我目前的版本为:jedis-2.1.0.jar + spring-data-redis-1.3.0.RELEASE.jar。

按照提示我将jedis升级成了jedis-2.4.2.jar。

再次运行,成功!!

哎,百度,不争气啊

http://zhaobing315.iteye.com/blog/2082189

Redis + Jedis + Spring整合遇到的异常(转)的更多相关文章

  1. Redis和Spring整合

    Redis和Spring整合 Redis在这篇里就不做介绍了~以后系统的学学,然后整理写出来. 首先是环境的搭建 通过自己引包的方式,将redis和spring-redis的包引到自己的项目中,我项目 ...

  2. redis与spring整合实例

    1)首先是redis的配置. 使用的是maven工程,引入redis与spring整合的相关jar包 <!-- redis服务 start--> <dependency> &l ...

  3. Redis实战之征服 Redis + Jedis + Spring (一)

    Redis + Jedis + Spring (一)—— 配置&常规操作(GET SET DEL)接着需要快速的调研下基于Spring框架下的Redis操作. 相关链接: Redis实战 Re ...

  4. Redis实战之征服 Redis + Jedis + Spring (二)

    不得不说,用哈希操作来存对象,有点自讨苦吃! 不过,既然吃了苦,也做个记录,也许以后API升级后,能好用些呢?! 或许,是我的理解不对,没有真正的理解哈希表. 相关链接: Redis实战 Redis实 ...

  5. Redis实战之征服 Redis + Jedis + Spring (三)

    一开始以为Spring下操作哈希表,列表,真就是那么土.恍惚间发现“stringRedisTemplate.opsForList()”的强大,抓紧时间恶补下. 通过spring-data-redis完 ...

  6. 征服 Redis + Jedis + Spring (一)—— 配置&常规操作(GET SET DEL)

    有日子没写博客了,真的是忙得要疯掉. 完成项目基础架构搭建工作,解决了核心技术问题,接着需要快速的调研下基于Spring框架下的Redis操作. 相关链接: 征服 Redis 征服 Redis + J ...

  7. 征服 Redis + Jedis + Spring (三)—— 列表操作【转】

    一开始以为Spring下操作哈希表,列表,真就是那么土.恍惚间发现“stringRedisTemplate.opsForList()”的强大,抓紧时间恶补下. 相关链接: 征服 Redis 征服 Re ...

  8. 分布式缓存技术redis学习系列(五)——redis实战(redis与spring整合,分布式锁实现)

    本文是redis学习系列的第五篇,点击下面链接可回看系列文章 <redis简介以及linux上的安装> <详细讲解redis数据结构(内存模型)以及常用命令> <redi ...

  9. 分布式缓存技术redis系列(五)——redis实战(redis与spring整合,分布式锁实现)

    本文是redis学习系列的第五篇,点击下面链接可回看系列文章 <redis简介以及linux上的安装> <详细讲解redis数据结构(内存模型)以及常用命令> <redi ...

随机推荐

  1. OTN交换&amp;P-OTN有效减少100G网络成本(一)

    近年来.网络运营商一直严重依赖基于ROADM的光传送设备,利用固定的点到点WDN联接.利用10G波长在整个城域网和广域网中汇聚及传送client业务.假设这些网络经过精细的设计规划,也能够合理.有效地 ...

  2. linux下磁盘分区

    转自于:http://pengyl.blog.51cto.com/5591604/1193963 命令:fdisk 功能:查看磁盘使用情况和分割磁盘 使用方法:                一.在 ...

  3. ThinkPHP - URL - 伪静态 - 路由 - 重写

    URL: 一.URL规则 1.默认是区分大小写,可以修改(配置文件)为不区分大小写. 2. //修改URL大小写问题 'URL_CASE_INSENSITIVE' =>true, 如果模块名为 ...

  4. 再见了acm

    2013年11月17日长沙区域赛我的最后一场区域赛. 忙碌了三年的acm要停下脚步,一时还无法接受. 这样一个结果有点无奈. 感谢队友,三年三支队伍五个队友,感谢你们.(每当写到这里时就总有点小忍不住 ...

  5. django email用法

    在settings里面设置 EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'EMAIL_PORT = 25EMAIL_HOST ...

  6. 基于Sql Server 2008的分布式数据库的实践(四)

    原文 基于Sql Server 2008的分布式数据库的实践(四) 数据库设计 1.E-R图 2.数据库创建 Win 7 1 create database V3 Win 2003 1 create  ...

  7. c# 数据库编程(利用DataSet 和 DataAdaper对象操作数据库--单表操作)

    一.概述 前面2篇文章,介绍了使用SqlCommand对象利用sql命令来操作数据库. 这篇文章我们来介绍使用c#的DataSet 和 DataAdaper对象操作操作数据库. 先来介绍下这两个对象是 ...

  8. linux 学习:环境变量设置

    一.临时环境变量 临时环境变量,只对当前打开的shell生效,shell关闭后,环境变量失效. 设置方法一: 分两步 MYPARA=hello export MYPARA 设置方法二:一步完成 exp ...

  9. 基于visual Studio2013解决C语言竞赛题之0523魔方阵

     题目

  10. 安装虚拟机时出现The Microsoft Runtime DLL

    参考文档: http://zhidao.baidu.com/link?url=1E4vr6ToPGm_kAZw4voOqzrPtzGaSIqy3kvcGXehs3KJAkirNKOHJbrsxec3f ...