Skip to content

Spring boot autoconfigure calls RedisSentinelConfiguration.setUsername which doesn't exist #30861

@GSvensk

Description

@GSvensk

Error message

12:18:07.526 [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redis' defined in class path resource [com/org/api/common/health/redis/RedisHealthCheckAutoConfiguration.class]: Unsatisfied dependency expressed through method 'redis' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/data/redis/JedisConnectionConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.redis.connection.jedis.JedisConnectionFactory]: Factory method 'redisConnectionFactory' threw exception; nested exception is java.lang.NoSuchMethodError: 'void org.springframework.data.redis.connection.RedisSentinelConfiguration.setUsername(java.lang.String)'

...

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.boot.autoconfigure.data.redis.RedisConnectionConfiguration.getSentinelConfig(RedisConnectionConfiguration.java:85)

The following method did not exist:

    'void org.springframework.data.redis.connection.RedisSentinelConfiguration.setUsername(java.lang.String)'

The method's class, org.springframework.data.redis.connection.RedisSentinelConfiguration, is available from the following locations:

    jar:file:/Users/mymac/.m2/repository/org/springframework/data/spring-data-redis/2.2.4.RELEASE/spring-data-redis-2.2.4.RELEASE.jar!/org/springframework/data/redis/connection/RedisSentinelConfiguration.class

The class hierarchy was loaded from the following locations:

    org.springframework.data.redis.connection.RedisSentinelConfiguration: file:/Users/mymac/.m2/repository/org/springframework/data/spring-data-redis/2.2.4.RELEASE/spring-data-redis-2.2.4.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.redis.connection.RedisSentinelConfiguration

My understanding is that there is no compatible version available of org.springframework.data.redis.connection.RedisSentinelConfiguration because

#29661 added

which calls RedisSentinelConfiguration.setUsername() resulting in a NoSuchMethodError seen above. setUsername was added
in spring-projects/spring-data-redis#2218 which won't be released until 2.7.0.

Versions:

spring-boot version: 2.5.13
spring-boot-autoconfigure version: 2.5.13
spring-redis-data version: 2.2.4.RELEASE

application.yaml contains

spring:
  redis:
    sentinel:
      master: mymaster
      nodes: redis-sentinel:26379

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions