Springboot session redis shared cache reported java.lang.NoSuchMethodError error

I use spring-session and redis to share session, and then report the following error. It looks as if spring-context-5.0.7.RELEASE and spring-session-1.3.3.RELEASE are in conflict, but I didn"t directly quote whether spring-context, is in some stater package. Ask for guidance

2018-07-31 08:24:00.002 ERROR 18436 --- [pool-2-thread-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task.

java.lang.NoSuchMethodError: org.springframework.data.redis.core.RedisOperations.delete(Ljava/lang/Object;)V
    at org.springframework.session.data.redis.RedisSessionExpirationPolicy.cleanExpiredSessions(RedisSessionExpirationPolicy.java:132) ~[spring-session-1.3.3.RELEASE.jar:na]
    at org.springframework.session.data.redis.RedisOperationsSessionRepository.cleanupExpiredSessions(RedisOperationsSessionRepository.java:398) ~[spring-session-1.3.3.RELEASE.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_101]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_101]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_101]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_101]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_101]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_101]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]

I found the problem because I used version 2.0.3 of springboot. Just change it back to 1.5.9.
using springboot 2 to integrate redis + jedis + spring-session + security to login and session sharing still needs to be studied


there should be other solutions besides downgrading, right?


I have also been fooled by this these two days. To sum up, it is really a version problem. Spring5 (springboot2.x) only supports spring-session-core.
the highest version of spring-session:1.3.5 is no longer updated and is supported to spring-session-data-redis:1.8.

according to the official document, spring-session-data-redis2.x can only be used with spring-session-core2.x,. The project I am working on now is separated from the front and back end. The old version of spring-session can achieve session consistency, but there will be session inconsistencies with the new spring-session-core. In the end, we have no choice but to abandon the spring-session framework and use the native session mechanism.

later, I am trying to optimize the directly connected redis to implement pseudo-session or token encrypted transfer userid

.
Menu