Skip to content

Binary-incompatible removal of SetParams.ex(long) override in Jedis 6.x causes NoSuchMethodError #3144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maarten-blokker opened this issue May 7, 2025 · 4 comments
Assignees
Labels
in: jedis Jedis driver type: dependency-upgrade A dependency upgrade

Comments

@maarten-blokker
Copy link

maarten-blokker commented May 7, 2025

After upgrading to Jedis 6.0.0 while using Spring Data Redis 3.4.5, any call to StringRedisTemplate.opsForValue().set(...) (or equivalent) fails with:

java.lang.NoSuchMethodError: 'redis.clients.jedis.params.SetParams redis.clients.jedis.params.SetParams.ex(long)'
  at org.springframework.data.redis.connection.jedis.JedisConverters.toSetCommandExPxArgument(JedisConverters.java:382)
  at org.springframework.data.redis.connection.jedis.JedisStringCommands.set(JedisStringCommands.java:112)
  at org.springframework.data.redis.connection.DefaultedRedisConnection.set(DefaultedRedisConnection.java:326)
  at org.springframework.data.redis.core.DefaultValueOperations.lambda$set$15(DefaultValueOperations.java:208)
  at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:411)
  at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:378)
  at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:117)
  at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:208)
  at org.springframework.data.redis.core.ValueOperations.set(ValueOperations.java:75)

Spring Data Redis was compiled against a version of Jedis where SetParams declared its own public SetParams.ex(long) override. In Jedis PR #4095, that override was removed (inheriting the method from a now-package-private superclass), breaking binary compatibility.

Reproducability

Use spring-data-redis 3.4.5 in combination with Jedis 6.0.0

// build.gradle
plugins {
    id 'java'
    id 'org.springframework.boot' version '3.1.2'
    id 'io.spring.dependency-management' version '1.1.0'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation 'org.springframework.data:spring-data-redis:3.4.5'
    implementation 'redis.clients:jedis:6.0.0'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
//src/test/java/com/example/RedisReproducerTest.java
package com.example;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;

import java.time.Duration;

@SpringBootTest
class RedisReproducerTest {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @Test
    void testSetWithExpiry() {
        // This triggers the NoSuchMethodError at runtime
        redisTemplate.opsForValue().set("test:key", "value", Duration.ofSeconds(10));
    }
}

Expected behaviour

JedisConverters.toSetCommandExPxArgument should be able to call SetParams.ex(long).

Either:

  • Jedis 6.x re-introduces the public override SetParams.ex(long) in SetParams (i can create an issue there as well)
  • Spring-data-redis updates its converter to call the inherited method reflectively or adapt to the new class hierarchy. (unlikely a good idea)
  • Documentation is updated to note that Jedis 6.x is currently not binary-compatible and pinning to 5.x is required until spring-data-redis is compiled against the new Jedis version. (most pragmatic solution)
@maarten-blokker maarten-blokker changed the title Binary-incompatible removal of SetParams.ex(long) override in Jedis 6.x causes NoSuchMethodError in Spring Data Redis Binary-incompatible removal of SetParams.ex(long) override in Jedis 6.x causes NoSuchMethodError May 7, 2025
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 7, 2025
@mp911de
Copy link
Member

mp911de commented May 7, 2025

We have no immediate plans to upgrade to Jedis 6 as Jedis 6 was released after (Apr 30) our release candidate (Apr 22). SetParams.ex(long) hasn't been deprecated, and there has been no way for us to know about any replacement. We are likely to upgrade to Jedis 6 with the November release.

@mp911de mp911de added type: dependency-upgrade A dependency upgrade and removed status: waiting-for-triage An issue we've not yet triaged labels May 7, 2025
@maarten-blokker
Copy link
Author

We have no immediate plans to upgrade to Jedis 6 as Jedis 6 was released after (Apr 30) our release candidate (Apr 22). SetParams.ex(long) hasn't been deprecated, and there has been no way for us to know about any replacement. We are likely to upgrade to Jedis 6 with the November release.

Makes sense, perhaps it would be prudent to mention the driver incompatibility in the readme?

@mp911de
Copy link
Member

mp911de commented May 8, 2025

Ideally, Jedis would fix that issue on their side instead of us compensating for them breaking things.

@mp911de mp911de added the in: jedis Jedis driver label May 15, 2025
@mp911de mp911de added this to the 3.5 GA (2025.0.0) milestone May 15, 2025
@mp911de
Copy link
Member

mp911de commented May 15, 2025

A few things come together here. Our 3.5 release will be the last 3.x feature release. Additionally, it has an extended maintenance period. Shipping an LTS version that isn't compatible with the recent driver version isn't ideal.

After consulting the team, we plan to upgrade to the new driver version to fix the binary incompatibility. We won't add integration for new driver functionality in the 3.x release.

@mp911de mp911de changed the title Binary-incompatible removal of SetParams.ex(long) override in Jedis 6.x causes NoSuchMethodError Binary-incompatible removal of SetParams.ex(long) override in Jedis 6.x causes NoSuchMethodError May 15, 2025
mp911de added a commit that referenced this issue May 15, 2025
@mp911de mp911de self-assigned this May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: jedis Jedis driver type: dependency-upgrade A dependency upgrade
Projects
None yet
Development

No branches or pull requests

3 participants