Home > Software design >  is it possible to use the newest jedis in spring project
is it possible to use the newest jedis in spring project

Time:05-11

when I force the jedis to use the newest verson 4.2.3 in build.gradle like this:

resolutionStrategy {
            eachDependency { DependencyResolveDetails details ->
                
                if (details.requested.group == 'redis.clients' && details.requested.name == 'jedis' ) {
                    details.useVersion("4.2.3")
                }
            }
        }

the spring project shows error like this:

Caused by: java.lang.NoClassDefFoundError: redis.clients.jedis.GeoUnit
    at org.springframework.data.redis.connection.jedis.JedisConnectionFactory.<clinit>(JedisConnectionFactory.java:93) ~[spring-data-redis-2.6.4.jar!/:2.6.4]
    at org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration.createJedisConnectionFactory(JedisConnectionConfiguration.java:74) ~[spring-boot-autoconfigure-2.6.7.jar!/:2.6.7]
    at org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration.redisConnectionFactory(JedisConnectionConfiguration.java:62) ~[spring-boot-autoconfigure-2.6.7.jar!/:2.6.7]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.19.jar!/:5.3.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$316/0x0000000070e22f90.getObject(Unknown Source) ~[?:?]

I want to use the xpending feature of jedis, seems the spring boot data is not compatible with the newest jedis. is it possible to fix this problem?

CodePudding user response:

Short answer, NO.

There are some users [1][2][3] who are using Jedis 4 but this is possible IFF you are not using some certain features and are willing to go through some extra works.


BTW, spring-data-redis is on the way of upgrading their support to Jedis 4. Perhaps, you can wait for this upgrade.

  • Related