Spring整合redis的錯誤
spring整合redis的錯誤
在整合spring和redis的時候出現瞭如下的錯誤
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisConnectionFactory' defined in class path resource [application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: redis.clients.jedis.JedisShardInfo.setTimeout(I)V
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.
doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
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.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.
finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.
refresh(AbstractApplicationContext.java:479)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at tongwan.reptile.test.UserDaoTest.before(UserDaoTest.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NoSuchMethodError: redis.clients.jedis.JedisShardInfo.setTimeout(I)V
at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.afterPropertiesSet(JedisConnectionFactory.java:168)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 35 more
錯誤原因,jedis客戶端版本過高,我採用的是2.7.2的版本的jedis
spring-data-redis用的1.4.2的版本
講jedis的版本號換位2.6.2以下就好了相關推薦
Spring整合redis的錯誤
spring整合redis的錯誤 在整合spring和redis的時候出現瞭如下的錯誤 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedi
spring整合redis
data sch throws ack xid .org source protect pid 1,利用spring-data-redis整合 項目使用的pom.xml: <project xmlns="http://maven.apache.org/POM/4.0
Spring整合Redis做數據緩存(Windows環境)
端口號 init 技術分享 factory redis-cli @service tab long 配置 當我們一個項目的數據量很大的時候,就需要做一些緩存機制來減輕數據庫的壓力,提升應用程序的性能,對於java項目來說,最常用的緩存組件有Redis、Ehcache和Mem
Spring整合Mybatis錯誤解決方案
pri ror org abs cto factor tran spring整合 原因 ERROR:java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransactionF
Spring整合Redis(spring-data-redis)
nds 獲取 可能 div 普通 工具 long red 等待 歷經幾天看了大量的博客資料,差不多算是搞定了,目前只是針對單個數據源,集群暫時沒研究 maven依賴 <properties> <!-- redis 版本 --> &l
網站性能優化小結和spring整合redis
remove utf ota turn tor package process 基本屬性 version 現在越來越多的地方需要非關系型數據庫了,最近網站優化,當然從頁面到服務器做了相應的優化後,通過在線網站測試工具與之前沒優化對比,發現有顯著提升。 服務器優化目前主要優化
spring 整合 redis的配置
index row val return created log idea pass truct 廢話不說,直接上代碼: 1、先添加依賴包 <!--redis--> <dependency>
Spring整合Redis報ClassCastException
最近在用Spring註解方式Cacheable 整合Redis的時候,報ClassCastException 異常,我方法返回值是一個PageVo, 報不能將PageVo 不能轉換成String 型別。一開始網上搜都是說SpringBoot整合方案,但我用的是Spring的方式的,後來看過幾
Spring整合Redis註解實現
之前我們說了Spring這個Redis,使用RedisTemplate 實現,不過有些地方也過於麻煩,因此Spring 團隊對 Jedis 進行了封裝,獨立為 spring-data-redis 專案,配合 spring 特性並整合 Jedis 的一些命令和方法。並提供了相關注解,幫助我們快
Spring整合Mybatis錯誤Result Maps collection already contains val
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
Spring整合redis帶測試用例Demo完整程式碼
專案結構 jar包 <!--redis--> <dependency> <groupId>redis.clients</groupId> <artifa
【nosql-redis】spring整合redis
環境: MAVEN+SPRING+MYBATIS+MYSQL+REDIS 1 pom.xml檔案下載依賴: <dependency> <groupId>org.springframework.data</groupId> &
Spring整合redis叢集
目錄 1,說明 6,使用 1,說明 本文使用的客戶端為jedisCluster.它已經封裝了一些常用操作。故只需根據自己需要再進行封裝即可。 2,jar版本 使用的jar包的版本如下 jedis-2.9.0.jar(據網上反饋,只有這個版
spring整合redis的配置檔案
說明: 1、檔案頭部分完整的除了redis還包含其他例如dubbo,aop等 2、 jedisPool,redisTemplate共用jedisPoolConfig,兩種可以同時存在,即在需要的類中@Autowired JedisPo
Redis - Spring 整合 Redis(RedisTemplate)
Jedis是Redis官方推薦的面向Java的操作Redis的客戶端,而RedisTemplate是SpringDataRedis中對JedisApi的高度封裝。 SpringDataRedis相對於Jedis來說可以方便地更換Redis的Java客戶端,比Jedis多了自動管理連線池的特性
spring整合redis單機版
1:在ApplicationContex.xml中配置JedisPool的例項。指定ip地址和埠號; 2:建立dao層介面; 3:實現介面 4:將快取新增到業務邏輯 注:JsonUtils
spring整合redis單機版與redis叢集版
前言: 有時候我們部署了叢集版的redis,還希望開發的時候使用單機版(畢竟省事兒),但是比較常用的Java客戶端(Jedis和Lettuce)的單機和叢集api是不統一的。經過調研,發現spring-data-redis可以實現這個需求,本文就是將spring-data-
Spring整合redis,通過sentinel進行主從切換。(何志雄)
實現功能描述: redis伺服器進行Master-slaver-slaver-....主從配置,通過2臺sentinel進行failOver故障轉移,自動切換,採用該程式碼完全可以直接用於實際生產環境。 題外話: 一般來說這樣的部署
Spring整合redis,通過sentinel進行主從切換
實現功能描述: redis伺服器進行Master-slaver-slaver-....主從配置,通過2臺sentinel進行failOver故障轉移,自動切換,採用該程式碼完全可以直接用於實際生產環境。 題外話:
Spring 整合redis叢集 實現 以及過程中需要注意的問題點
一,準備工作: 1.首先安裝好redis叢集,啟動並配置叢集。 2.SpringMVC環境,看專案或個人需要,可以使SpringMVC的web專案,也可以是隻使用SpringBean管理器。 二,著手配置: 由於專案是由maven管理的所以需要的jar 包新增到maven