question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NoSuchMethodError when invoking RedisOperationsSessionRepository.delete

See original GitHub issue

I’m using spring session and spring data redis for session management. I haven’t used Spring boot.

Used are as follows,

spring-session: 1.3.5.RELEASE
spring-data-redis: 2.1.4.RELEASE
spring-webmvc: 5.0.4.RELEASE
lettuce-core: 5.1.4.RELEASE

Included these beans for redis configuration: org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration, org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.

Included filter springSessionRepositoryFilter in web.xml.

But I got following error frequently.

ERROR org.springframework.scheduling.support.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.5.RELEASE.jar:?]
	at org.springframework.session.data.redis.RedisOperationsSessionRepository.cleanupExpiredSessions(RedisOperationsSessionRepository.java:398) ~[spring-session-1.3.5.RELEASE.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201]
	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
	at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) [spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_201]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_201]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asha-chandrancommented, Mar 13, 2019

As explained in spring-projects/spring-framework#22538, this is due to use of incompatible dependency versions.

If you’re using Spring Framework 5.x you need to upgrade to Spring Session 2.x. I again encourage you to take a look at Upgrading to 2.x section of Spring Session reference manual.

Okay. From where do I get spring session 2.x? Mine is Maven project and in maven repository(central) latest I could download is spring session 1.3.5.

0reactions
TonnyPaulosecommented, Jun 2, 2021

I have upgraded the spring session version to spring-session-2.0.0.M2.jar , still, I am getting the same exception.

When I open the jar file I can see the delete method. So I created a package with the name org.springframework.session.data.redis and copied RedisSessionExpirationPolicy class from jar file. then the issue is resolved. I am not sure really its a dependency version issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - NoSuchMethodError when invoking ... - Stack Overflow
NoSuchMethodError when invoking RedisOperationsSessionRepository.delete ... I'm using Spring Session and Spring Data Redis for session management.
Read more >
[Solved]-NoSuchMethodError when invoking ...
Coding example for the question NoSuchMethodError when invoking RedisOperationsSessionRepository.delete-Java.
Read more >
NoSuchMethodError: when invoking Redis opertaion Delete
Im using Spring session, Spring Data redis and redis clients for session management. Here im getting belw exception while deploy the ...
Read more >
NoSuchMethodError (Java SE 18 & JDK 18)
Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has...
Read more >
org.springframework.data.redis.core.RedisOperations.delete ...
Best Java code snippets using org.springframework.data.redis.core.RedisOperations.delete (Showing top 20 results out of 315).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found