Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring ehcache no such method error

Caused by: java.lang.NoSuchMethodError: org.springframework.cache.ehcache.EhCach
eFactoryBean.setMaxEntriesLocalHeap(J)V


    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
            at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
            at org.springframework.beans.factory.support.SimpleInstantiationStrategy
    .instantiate(SimpleInstantiationStrategy.java:89)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBean
    Factory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1086)
            ... 192 more
    Caused by: java.lang.NoSuchMethodError: org.springframework.cache.ehcache.EhCach
    eFactoryBean.setMaxEntriesLocalHeap(J)V
            at org.springframework.cache.ehcache.EhCacheFactoryBean.<init>(EhCacheFa
    ctoryBean.java:101)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
    orAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
    onstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
            at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1
    47)
            ... 194 more
like image 573
user3364699 Avatar asked Oct 22 '25 07:10

user3364699


1 Answers

Error seems to be quite clear

Version 2.5 that you use does not have the method.

Version 4.1 of EhCacheFactoryBean seems to have the method.

I guess you have mixed incompatible versions of jars.

like image 70
Cristian Sevescu Avatar answered Oct 24 '25 20:10

Cristian Sevescu