java.lang.NoSuchMethodError: redis.clients.jedis.JedisPool.getResource()Lredis/clients/jedis/Jedis;

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_38680031/article/details/77649995

1、今天遇到了一个问题我去查询redis里面的key对应的值的时候 在调用RedisClient的get方法的时候在走到1.png中蓝色的部分的时候程序终止,junit错误为


java.lang.NoSuchMethodError: redis.clients.jedis.JedisPool.getResource()Lredis/clients/jedis/Jedis;
at com.ucf.framework.redis.jedis.cluster.core.ClusterStatus.getJedisWrapperByGroupName(ClusterStatus.java:143)
at com.ucf.framework.redis.jedis.cluster.core.SafeFailoverUnlostShardedJedisFactory.getJedisWrapperByGroupName(SafeFailoverUnlostShardedJedisFactory.java:239)
at com.ucf.framework.redis.jedis.cluster.core.SafeFailoverUnlostShardedJedisFactory.getCurrentJedisWrapper(SafeFailoverUnlostShardedJedisFactory.java:186)
at com.ucf.framework.redis.jedis.cluster.core.SafeFailoverUnlostShardedJedisFactory.getJedisWrapper(SafeFailoverUnlostShardedJedisFactory.java:178)
at com.ucf.framework.redis.jedis.cluster.core.ClusterRedisClient.get(ClusterRedisClient.java:35)
at com.ucf.commonpay.component.WithdrawRedisService.findAutoIncInfoRedis(WithdrawRedisService.java:40)
at com.ucf.commonpay.component.WithdrawRedisService$$FastClassByCGLIB$$290c2369.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:64)
at com.ucf.platform.framework.log.aop.AnnotatedLogInterceptor.bizInvoke(AnnotatedLogInterceptor.java:59)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:61)
at com.ucf.platform.framework.log.aop.PerformanceMonitorInterceptor.bizInvoke(PerformanceMonitorInterceptor.java:39)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:61)
at com.ucf.platform.framework.serviceframework.aop.ServiceContextInitInterceptor.bizInvoke(ServiceContextInitInterceptor.java:79)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:61)
at com.ucf.platform.framework.core.aop.InterceptorChain.bizInvoke(InterceptorChain.java:25)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.ucf.commonpay.component.WithdrawRedisService$$EnhancerByCGLIB$$cd79acf3.findAutoIncInfoRedis(<generated>)
at com.ucf.commonpay.service.impl.QueryServiceImpl.queryChannelInterceptWithdrawForPage(QueryServiceImpl.java:491)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:64)
at com.ucf.platform.framework.log.aop.AnnotatedLogInterceptor.bizInvoke(AnnotatedLogInterceptor.java:59)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:61)
at com.ucf.platform.framework.log.aop.PerformanceMonitorInterceptor.bizInvoke(PerformanceMonitorInterceptor.java:39)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:61)
at com.ucf.platform.framework.serviceframework.aop.ServiceContextInitInterceptor.bizInvoke(ServiceContextInitInterceptor.java:79)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at com.ucf.platform.framework.core.aop.InterceptorChainSupport.proceed(InterceptorChainSupport.java:61)
at com.ucf.platform.framework.core.aop.InterceptorChain.bizInvoke(InterceptorChain.java:25)
at com.ucf.platform.framework.core.aop.BaseInterceptor.invoke(BaseInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy53.queryChannelInterceptWithdrawForPage(Unknown Source)
at com.ucf.commonpay.service.test.QueryOrderServiceTest.queryChannelInterceptWithdrawForPageTest(QueryOrderServiceTest.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
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)


2、我找配置发现redis的xml文件没有问题,在Spring里面也import了这个xml,百度说 有redis超时连接的问题,但是现状用的都不是framework的redis了 超时连接的时间也没有设置,我后来想是不是我在2.png的配置有问题,那也不可能一个是url连接这块肯定连接上了 另外一个就是一般写的是当前服务的名字不影响什么


3、然后Juin考虑
java.lang.NoSuchMethodError: redis.clients.jedis.JedisPool.getResource()Lredis/clients/jedis/Jedis;

就开始在pom文件里面找jedis,发现我引用了一个2.4.2的jedis,而我新的redisclient里面包含2.5.1的jedis,另外 我引用了其他系统,其他系统里也引用了2.4.1的jar,

  <dependency>
<groupId>com.abc.account</groupId>
<artifactId>account-client</artifactId>
<version>1.4.7</version>

                   
<exclusions>
<exclusion>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</exclusion>


</exclusions>
            </dependency>


 <exclusions>这个就是讲jedisjar包的引用去除 这样就解决了jar包冲突的问题,主要是 我它的jedis是低版本如果是高版本的 可以向上兼容也不会出现这个问题



展开阅读全文

没有更多推荐了,返回首页