I am trying to replace the default JDBC session management in my Spring application with Redis, using Spring Session Data Redis 2.2.2.RELEASE and Jedis 3.10.0 on Java 11. However, I am getting the following error on application startup:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in RedisHttpSessionConfiguration: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: 'java.util.List org.springframework.data.redis.connection.RedisConnection.getConfig(java.lang.String)'
I have tried various version combinations of the dependencies but get the same error. This seems to be related to some incompatibility between Spring Session Data Redis and the Jedis client. Has anyone encountered this error before when setting up Redis HTTP session management with Spring? Any tips on how to resolve it?
Using different session data redis versions and jedis client versions
Spring Session Data Redis 2.2.2.RELEASE is not currently supported anymore and I don't think that the version of Spring Data Redis that is uses is compatible with Jedis 3.10.0. Furthermore, that version of Spring Session is not compatible with Spring Framework 5.3.22.
Try using the latest version compatible with Spring Framework 5.3.22, like so:
<dependencies>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-bom</artifactId>
<version>2021.2.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>