Issue with ehcache 2.5.1
Posted: Fri Apr 20, 2012 6:05 pm
Hi,
I 've noticed that Broadleaf libraries set a dependency for Ehcache 2.4.2 . In the environment that I am building and running Ehcache 2.5.1 is used. However I've noticed that switching to version 2.5.1 creates a strange duplicated cache exception.
Specifically I am seeing the following:
[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blCacheManager' defined in resource loaded from byte array: Invocation of init method failed; nested exception is net.sf.ehcache.ObjectExistsException: Cache hydrated-cache already exists
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
[artifact:mvn] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
[artifact:mvn] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
[artifact:mvn] at org.broadleafcommerce.profile.web.extensibility.MergeContextLoader.createWebApplicationContext(MergeContextLoader.java:104)
[artifact:mvn] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
[artifact:mvn] at org.broadleafcommerce.profile.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:42)
.......
[artifact:mvn] Caused by: net.sf.ehcache.ObjectExistsException: Cache hydrated-cache already exists
[artifact:mvn] at net.sf.ehcache.C:197)
[artifact:mvn] at org.broadleafcommerce.profile.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListenacheManager.addCacheNoCheck(CacheManager.java:1150)
[artifact:mvn] at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:705)
[artifact:mvn] er.java:42)
[artifact:mvn] at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
[artifact:mvn] at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
[artifact:mvn] at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
[artifact:mvn] at org.morat net.sf.ehcache.CacheManager.doInit(CacheManager.java:423)
[artifact:mvn] at net.sf.ehcache.CacheManager.init(CacheManager.java:357)
[artifact:mvn] at net.sf.ehcache.CacheManager.<init>(CacheManager.java:242)
[artifact:mvn] at net.sf.ehcache.CacheManager.create(CacheManager.java:853)
[artifact:mvn] at net.sf.tbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
[artifact:mvn] at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContehcache.CacheManager.create(CacheManager.java:817)
[artifact:mvn] at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiext.java:467)
[artifact:mvn] at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
[artifact:mvn] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[artifact:mvn] at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerColesSet(EhCacheManagerFactoryBean.java:103)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invoklection.java:152)
[artifact:mvn] at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
[artifact:mvn] at org.morteInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapablebay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[artifact:mvn] at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
[artifact:mvn] ... 56 more
"hydrated-cache" is created by EhcacheHydratedCacheManagerImpl class, which is invoked by HydratedCacheEventListenerFactory
This listener factory is attached to "blStandardElements" cache definition in bl-ehcache.xml descriptor. It's also included in "mycompany-override-ehcache.xml" archetype definition under quick-start/ecommerce-archetype and hence shows up in every generated project.
It seems that disabling cacheEventListenerFactory removes the problem. However, I am not quite sure what are the implications of that.
Can you please clarify, how is this suppose to function?
I 've noticed that Broadleaf libraries set a dependency for Ehcache 2.4.2 . In the environment that I am building and running Ehcache 2.5.1 is used. However I've noticed that switching to version 2.5.1 creates a strange duplicated cache exception.
Specifically I am seeing the following:
[artifact:mvn] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blCacheManager' defined in resource loaded from byte array: Invocation of init method failed; nested exception is net.sf.ehcache.ObjectExistsException: Cache hydrated-cache already exists
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
[artifact:mvn] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
[artifact:mvn] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
[artifact:mvn] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
[artifact:mvn] at org.broadleafcommerce.profile.web.extensibility.MergeContextLoader.createWebApplicationContext(MergeContextLoader.java:104)
[artifact:mvn] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
[artifact:mvn] at org.broadleafcommerce.profile.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListener.java:42)
.......
[artifact:mvn] Caused by: net.sf.ehcache.ObjectExistsException: Cache hydrated-cache already exists
[artifact:mvn] at net.sf.ehcache.C:197)
[artifact:mvn] at org.broadleafcommerce.profile.web.extensibility.MergeContextLoaderListener.contextInitialized(MergeContextLoaderListenacheManager.addCacheNoCheck(CacheManager.java:1150)
[artifact:mvn] at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:705)
[artifact:mvn] er.java:42)
[artifact:mvn] at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
[artifact:mvn] at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
[artifact:mvn] at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
[artifact:mvn] at org.morat net.sf.ehcache.CacheManager.doInit(CacheManager.java:423)
[artifact:mvn] at net.sf.ehcache.CacheManager.init(CacheManager.java:357)
[artifact:mvn] at net.sf.ehcache.CacheManager.<init>(CacheManager.java:242)
[artifact:mvn] at net.sf.ehcache.CacheManager.create(CacheManager.java:853)
[artifact:mvn] at net.sf.tbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
[artifact:mvn] at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContehcache.CacheManager.create(CacheManager.java:817)
[artifact:mvn] at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiext.java:467)
[artifact:mvn] at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
[artifact:mvn] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[artifact:mvn] at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerColesSet(EhCacheManagerFactoryBean.java:103)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invoklection.java:152)
[artifact:mvn] at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
[artifact:mvn] at org.morteInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
[artifact:mvn] at org.springframework.beans.factory.support.AbstractAutowireCapablebay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[artifact:mvn] at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
[artifact:mvn] ... 56 more
"hydrated-cache" is created by EhcacheHydratedCacheManagerImpl class, which is invoked by HydratedCacheEventListenerFactory
This listener factory is attached to "blStandardElements" cache definition in bl-ehcache.xml descriptor. It's also included in "mycompany-override-ehcache.xml" archetype definition under quick-start/ecommerce-archetype and hence shows up in every generated project.
It seems that disabling cacheEventListenerFactory removes the problem. However, I am not quite sure what are the implications of that.
Can you please clarify, how is this suppose to function?