最近在使用Jedis过程中出现了以下的异常:
2012-08-02 20:26:31,697 ERROR [pool-4-thread-1] (TrimQueueTask.java:74) - redis.clients.jedis.Jedis.lpush(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Long;
java.lang.NoSuchMethodError: redis.clients.jedis.Jedis.lpush(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Long;
at com.www.eee.rrrr.client.dao.RedisManager.lpush(RedisManager.java:85)
at
com.www.eee.rrrr.client.
task.TrimQueueTask.run(TrimQueueTask.java:67)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
通过Google 找到了出现问题的原因:原帖:
http://jimgreat.iteye.com/blog/1612497
问题原因:
由于我在编译时使用的是jedis2.1.0的包,而项目中使用的是jedis2.0.0的包 于是乎出现了这个问题
问题解决:
将编译环境中的jedie2.1.0换成
jedis2.0.0 问题解决
原因分析:
由于
jedie2.1.0中方法签名为
java.lang.Long redis.clients.jedis.Jedis.lpush(java.lang.String,
java.lang.String...
)
jedie2.0.0中方法签名为
java.lang.Long
redis.clients.jedis.Jedis.lpush(java.lang.String,
java.lang.String
)