spring-mvctomcat7ehcachetomcat8grails-2.5

Deploying Grails WAR file from Tomcat 7 to Tomcat 8 gives Ehcache error


I have Grails web project developed in 2.5.1 version. It works fine in Tomcat 7.0.63. When I deploy same running WAR file in Tomcat 8.0.33, it gives ehcache error:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cache.ehcache.EhCacheFactoryBean]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.cache.ehcache.EhCacheFactoryBean.setMaxEntriesLocalHeap(J)V

I know it's due to ehcache old version, but the same war was working fine in Tomcat 7, so, what's wrong in Tomcat 8 ?

Any help would be great.

Thanks.

Update: If I replace all jar files of Tomcat 8 by Tomcat 7, then it works. But it seems like stupid thing to do this.


Solution

  • There was multiple ehcache jar files in project. Hibernate cache and spring cache, seems like spring cache was pointing to old jar in Tomcat8. We forced excluding ehcache-core and it worked.

    For more info: Exclude plugin