• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • Integration Modules
  • nadeem
  • Reporter: amiller
  • June 25, 2008
  • 0
  • Watchers: 1
  • August 27, 2008
  • July 23, 2008

Attachments

Description

Spring Modules Caching is a part of the Spring Modules project (https://springmodules.dev.java.net/) and provides a very simple way to wrap an interceptor around a bean and cache method results (based on parameter inputs as key). They have several providers. I tested this with the ehcache provider and it didn’t work. Seems like it should with a presumably small amount of work.

Attached zip has a small standalone sample project. run.sh will run with no Terracotta. run-tc.sh will run with Terracotta. Requires: Spring, Spring Modules (for ehcache), commons-logging (for Spring), ehcache, Ehcache TIM, jsr107 (due to our requirement of it when using the Ehcache TIM).

Error:

2008-06-25 01:26:56,706 WARN - The root expression ‘net.sf.ehcache.store.MemoryStoreEvictionPolicy.DSO’ meant for the class ‘net.sf.ehcache.store.MemoryStoreEvictionPolicy’ has no effect, make sure that it is a valid expression and that it is spelled correctly. AW::WARNING - could not load class [org/apache/commons/collections/LRUMap] as a resource in loader [[email protected]] Jun 25, 2008 1:26:57 AM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons INFO: Destroying singletons in org.s[email protected]37fd8a: defining beans [slowSquarer,main,cacheProvider,cacheManager,cachedSquarer]; root of factory hierarchy Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘main’ defined in class path resource [app.xml]: Cannot resolve reference to bean ‘cachedSquarer’ while setting bean property ‘squarer’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cachedSquarer’: Cannot resolve reference to bean ‘cacheProvider’ while setting bean property ‘cacheProviderFacade’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheProvider’: Cannot resolve reference to bean ‘cacheManager’ while setting bean property ‘cacheManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheManager’: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: DSO Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cachedSquarer’: Cannot resolve reference to bean ‘cacheProvider’ while setting bean property ‘cacheProviderFacade’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheProvider’: Cannot resolve reference to bean ‘cacheManager’ while setting bean property ‘cacheManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheManager’: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: DSO Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheProvider’: Cannot resolve reference to bean ‘cacheManager’ while setting bean property ‘cacheManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheManager’: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: DSO Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘cacheManager’: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: DSO Caused by: java.lang.NoSuchFieldError: DSO at net.sf.ehcache.store.MemoryStore.create(MemoryStore.java) at net.sf.ehcache.Cache.initialise(Cache.java:505) at net.sf.ehcache.CacheManager.__tc_wrapped_addCacheNoCheck(CacheManager.java:634) at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java) at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:348) at net.sf.ehcache.CacheManager.__tc_wrapped_init(CacheManager.java:227) at net.sf.ehcache.CacheManager.init(CacheManager.java) at net.sf.ehcache.CacheManager.(CacheManager.java:194) at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:117) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1172) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$original$_AW_$createBean$_AW_$org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at com.tcspring.GetBeanProtocol.beanNameCflow(GetBeanProtocol.java:74) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$INVOKE$_AW_$populateBean_764810460org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_2_674776996__798057117_599532254___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$original$_AW_$createBean$_AW_$org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java:423) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at com.tcspring.GetBeanProtocol.beanNameCflow(GetBeanProtocol.java:74) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$INVOKE$_AW_$populateBean_764810460org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_2_674776996__798057117_599532254___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$original$_AW_$createBean$_AW_$org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java:423) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at com.tcspring.GetBeanProtocol.beanNameCflow(GetBeanProtocol.java:74) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$INVOKE$_AW_$populateBean_764810460org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_2_674776996__798057117_599532254___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$original$_AW_$createBean$_AW_$org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java:423) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at com.tcspring.GetBeanProtocol.beanNameCflow(GetBeanProtocol.java:74) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291) at org.springframework.context.support.AbstractApplicationContext.aw$original$_AW_$refresh$_AW_$org_springframework_context_support_AbstractApplicationContext(AbstractApplicationContext.java:352) at org.springframework.context.support.AbstractApplicationContext_1__321890630_1085445456___AW_JoinPoint.invoke(Unknown Source) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:122) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:66) at caching.Main.main(Main.java:30)

Comments

Fiona OShea 2008-06-25

Do we want to try and make this work?

Alex Miller 2008-06-25

Of all the things we could support in Spring, this seems like one of the most useful, certainly more so than Spring events. It is of no urgency of course.

Abhishek Singh 2008-07-23

Fixed in trunk rev-9452

Now it works by following the on-screen instructions to rectify TCNonPortableObjectError.

Action to take:

1) Reconfigure to include the unshareable classes * edit your tc-config.xml file * locate the element \* add this snippet inside the element

   <instrumented-classes>
     <include>
       <class-expression>org.springmodules.cache.key.HashCodeCacheKey</class-expression>
     </include>
   </instrumented-classes>

Alex Miller 2008-08-04

This has already been fixed as DEV-1748 - need to update here as well.

Fiona OShea 2008-08-05

This fix will be available in the 2.6 branch nightly build after 7pm PT on 8/5

Fiona OShea 2008-08-14

please verify fixed in 2.6.3

nadeem ghani 2008-08-15

daily report of monkey status