I am facing an issue wherein the code tries to find cache named "AdministrationContactManagerImpl.retrieve" but it fails to find it.The target method is annotated with @cacheable.
@Cacheable(value="administrationContactManagerImpl.retrieve", key="#prefix + #contract + #effectiveDate + #administrationRoles")
public List<AdministrationContact> retrieve(Set<AdministrationRole> administrationRoles, Date effectiveDate,
I have not defined <ehcache:annotation-driven>
in my main applicationContext file.This means that caching should not get enabled and I should not run in to the errors as output in the stacktrace. I suspect some jar's in the classpath might be enabling the caching but how it is enabled and how can I detect it?
Can anyone tell how could I disable the caching so that I can avoid this error.
We are using spring version 3.1.1.Release jars.
java.lang.IllegalArgumentException: Cannot find cache named [administrationContactManagerImpl.retrieve] for CacheableOperation[public java.util.List com.principal.ris.contact.internal.impl.AdministrationContactManagerImpl.retrieve(java.util.Set,java.util.Date,java.lang.Integer,java.lang.String)] caches=[administrationContactManagerImpl.retrieve] | condition='' | key='#prefix + #contract + #effectiveDate + #administrationRoles'
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.cache.interceptor.CacheAspectSupport.getCaches(CacheAspectSupport.java:163)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.<init>(CacheAspectSupport.java:443)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.cache.interceptor.CacheAspectSupport.getOperationContext(CacheAspectSupport.java:173)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.cache.interceptor.CacheAspectSupport.createOperationContext(CacheAspectSupport.java:404)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:192)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at com.principal.ris.contact.internal.impl.AdministrationContactManagerImpl$$EnhancerByCGLIB$$ddaad355.retrieve(<generated>)
[4/17/13 14:44:50:001 IST] 0000001a SystemErr R at com.principal.ris.tpaview.listener.TpaViewUserTemplateListener.contextCreated(TpaViewUserTemplateListener.java:118)
Updating this post : I have selected the answer as best answer but I will tell you all what I did. In you java maven projects, you really do not need to include such annotations which can impact your context. As a best practice, always keep the switches configurations in your war's pom file.