Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring wired EhCache磁盘存储在多线程应用程序中创建冲突_Java_Spring_Ehcache - Fatal编程技术网

Java Spring wired EhCache磁盘存储在多线程应用程序中创建冲突

Java Spring wired EhCache磁盘存储在多线程应用程序中创建冲突,java,spring,ehcache,Java,Spring,Ehcache,直觉:看起来有点像两个线程都试图初始化基于磁盘的溢出缓存,但其中一个失败了 此应用程序中有两个线程。在以下日志提取中,它们由id0000004a和0000003d表示。它们同时开始: [3/04/12 10:17:50:832 EST] 0000004a EhCacheManage I org.springframework.cache.ehcache.EhCacheManagerFactoryBean afterPropertiesSet Initializing EHCache CacheM

直觉:看起来有点像两个线程都试图初始化基于磁盘的溢出缓存,但其中一个失败了

此应用程序中有两个线程。在以下日志提取中,它们由id0000004a0000003d表示。它们同时开始:

[3/04/12 10:17:50:832 EST] 0000004a EhCacheManage I org.springframework.cache.ehcache.EhCacheManagerFactoryBean afterPropertiesSet Initializing EHCache CacheManager
[3/04/12 10:17:50:832 EST] 0000003d EhCacheManage I org.springframework.cache.ehcache.EhCacheManagerFactoryBean afterPropertiesSet Initializing EHCache CacheManager
EhCache通过Spring连接:

<ehcache:annotation-driven cache-manager="ehCacheManager"/>
<bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>

并据此配置:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false">
    <diskStore path="java.io.tmpdir/GMM_DAO_Caches"/>

    <defaultCache eternal="false" maxElementsInMemory="1000"
              overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0"
              timeToLiveSeconds="300" memoryStoreEvictionPolicy="LRU"/>

    <cache name="dao_results" eternal="false" maxElementsInMemory="1000"
           overflowToDisk="true" diskPersistent="false" 
           timeToIdleSeconds="0" timeToLiveSeconds="3600"
           memoryStoreEvictionPolicy="LRU"/>

    <cache name="dao_results_shortlived" eternal="false" maxElementsInMemory="1000"
           overflowToDisk="true" diskPersistent="false" 
           timeToIdleSeconds="0" timeToLiveSeconds="300"
           memoryStoreEvictionPolicy="LRU"/>

</ehcache>

错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.config.internalEhCach
eCachingAdvisor': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0' while setting bean property
 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations
.impl.CacheStaticMethodMatcherPointcut#0': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0' while sett
ing bean property 'cacheAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.g
ooglecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0': Cannot resolve reference to bean 'ehCacheManager' while setting bean property 'cacheManager
'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehCacheManager' defined in class path resour
ce [ApplicationContext-DAOs.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Could not create cache directory "C:
\DOCUME~1\JMAWSO~1.NT3\LOCALS~1\Temp\GMM_DAO_Caches\ehcache_auto_created_1333412270879".
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:86)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:100)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:86)
    at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
    at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanF
actory.java:407)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1426)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        ... 35 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheStaticMetho
dMatcherPointcut#0': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0' while setting bean property 'cac
heAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.anno
tations.impl.CacheAttributeSourceImpl#0': Cannot resolve reference to bean 'ehCacheManager' while setting bean property 'cacheManager'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehCacheManager' defined in class path resource [ApplicationContext
-DAOs.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Could not create cache directory "C:\DOCUME~1\JMAWSO~1.NT3
\LOCALS~1\Temp\GMM_DAO_Caches\ehcache_auto_created_1333412270879".
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        ... 53 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheAttributeSo
urceImpl#0': Cannot resolve reference to bean 'ehCacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.fa
ctory.BeanCreationException: Error creating bean with name 'ehCacheManager' defined in class path resource [ApplicationContext-DAOs.xml]: Invocation of ini
t method failed; nested exception is net.sf.ehcache.CacheException: Could not create cache directory "C:\DOCUME~1\JMAWSO~1.NT3\LOCALS~1\Temp\GMM_DAO_Caches
\ehcache_auto_created_1333412270879".
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        ... 63 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehCacheManager' defined in class path resource [Applicat
ionContext-DAOs.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Could not create cache directory "C:\DOCUME~1\JM
AWSO~1.NT3\LOCALS~1\Temp\GMM_DAO_Caches\ehcache_auto_created_1333412270879".
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        ... 73 more
Caused by: net.sf.ehcache.CacheException: Could not create cache directory "C:\DOCUME~1\JMAWSO~1.NT3\LOCALS~1\Temp\GMM_DAO_Caches\ehcache_auto_created_1333
412270879".
    at net.sf.ehcache.store.compound.factories.DiskOverflowStorageFactory.getDataFile(DiskOverflowStorageFactory.java:89)
    at net.sf.ehcache.store.compound.factories.DiskOverflowStorageFactory.<init>(DiskOverflowStorageFactory.java:71)
    at net.sf.ehcache.store.compound.impl.OverflowToDiskStore.create(OverflowToDiskStore.java:63)
    at net.sf.ehcache.Cache.initialise(Cache.java:969)
    at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:967)
    at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:608)
    at net.sf.ehcache.CacheManager.init(CacheManager.java:339)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:280)
    at org.springframework.cache.ehcache.EhCacheManagerFactoryBean.afterPropertiesSet(EhCacheManagerFactoryBean.java:115)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
        ... 80 more
原因:org.springframework.beans.factory.BeanCreationException:创建名为'com.googlecode.ehcache.annotations.config.internalEhCach'的bean时出错
eCachingAdvisor':设置bean属性时无法解析对bean“com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0”的引用
“切入点”;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为'com.googlecode.ehcache.annotations'的bean时出错
.impl.CacheStaticMethodMatcherPointcut#0”:设置时无法解析对bean“com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0”的引用
正在初始化bean属性“cacheAttributeSource”;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为'com.g'的bean时出错
ooglecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0”:设置bean属性“cacheManager”时无法解析对bean“ehCacheManager”的引用
'; 嵌套异常为org.springframework.beans.factory.BeanCreationException:创建类路径资源中定义的名为“ehCacheManager”的bean时出错
ce[ApplicationContext DAOs.xml]:调用init方法失败;嵌套异常为net.sf.ehcache.CacheException:无法创建缓存目录“C:
\文档~1\JMAWSO~1.NT3\LOCALS~1\Temp\GMM_DAO_Caches\ehcache_auto_created_13334112270879”。
位于org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
在org.springframework.beans.factory.support.BeanDefinitionValueResolver.ResolveValueIfNeeded上(BeanDefinitionValueResolver.java:106)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
位于org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
位于org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
位于org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
位于org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.FindVisorBeans(BeanFactoryAdvisorRetrievalHelper.java:86)
位于org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:100)
位于org.springframework.aop.framework.autoproxy.AbstractAdvisorautorProxyCreator.findEligibleAdvisors(AbstractAdvisorautorProxyCreator.java:86)
位于org.springframework.aop.framework.autoproxy.AbstractAdvisoruToproxyCreator.GetAdvices和AdvisorForBean(AbstractAdvisoruToproxyCreator.java:68)
位于org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
位于org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory
java:407)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1426)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 35多
原因:org.springframework.beans.factory.BeanCreationException:创建名为'com.googlecode.ehcache.annotations.impl.cacheStaticMetro'的bean时出错
dMatcherPointcut#0”:设置bean属性“cac”时无法解析对bean“com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl”的引用
热源';嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为'com.googlecode.ehcache.anno'的bean时出错
tations.impl.CacheAttributeSourceImpl#0”:设置bean属性“cacheManager”时无法解析对bean“ehCacheManager”的引用;嵌套异常是
org.springframework.beans.factory.BeanCreationException:创建名为“ehCacheManager”的bean时出错,该bean在类路径资源[ApplicationContext]中定义
-xml]:调用init方法失败;嵌套异常为net.sf.ehcache.CacheException:无法创建缓存目录“C:\DOCUME~1\JMAWSO~1.NT3
\本地人~1\Temp\GMM\u DAO\u缓存\ehcache\u自动创建的\u 1333412270879”。
位于org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
在org.springframework.beans.factory.support.BeanDefinitionValueResolver.ResolveValueIfNeeded上(BeanDefinitionValueResolver.java:106)
位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
位于org.springframework.beans.factory.support.AbstractAu