EhCache and Spring – can’t find class EhCacheManagerFactoryBean?

I’m playing around with Spring and EhCache, and having a lot of fun. This problem stumped me for a few minutes as a lot of the tutorials I was playing around with didn’t mention a key dependency!

The Error

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.cache.ehcache.EhCacheManagerFactoryBean] for bean with name 'cacheManager' defined in class path resource [application-context.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.cache.ehcache.EhCacheManagerFactoryBean

The Missing Dependency…


You’ll also need two other core dependencies in addition to the standard Spring dependencies, but most tutorials/guides cover this:


As an aside, if you are looking for a great introduction and tutorial to using EhCache within Spring I can highly recommend Goyello’s Blog.

1 comment
  1. Wilson said:

    Nice tip! That missing dependency got me stuck until I found this!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: