1

I am trying to use EHCache -3.0.2 with Spring 4.2.1 using Jcache -1.0.0 but getting java.lang.ClassNotFoundException: net.sf.ehcache.CacheManager

I see in spring EhCacheCacheManager is setting up CacheManager is type of net.sf.ehcache.CacheManager which is not available in EHCache 3.0. EHChcache has type of org.ehcache.CacheManager.

Seems if I use Spring then I will have to lower down EHCache version, which I don't want.

Please suggest me if there is any workaround or will have to wait until Spring Introduce it.

I was following EHCache3+Spring4.2 but seems it also has same issue.

Håvard Geithus
  • 5,544
  • 7
  • 36
  • 51
Vijay Kumar Rajput
  • 1,071
  • 1
  • 10
  • 30

1 Answers1

3

The problem is that spring-context-support expects the Ehcache's CacheManager to be on this classpath: net.sf.ehcache.CacheManager

However, in Ehcache 3, the CacheManager class resides on another classpath: org.ehcache.CacheManager.

So, basically spring-context-support does not support Ehcache 3. And you would have to use the JSR-107 annotations directly, not the annotations provided by Spring.

Håvard Geithus
  • 5,544
  • 7
  • 36
  • 51