2
我正在嘗試創建一個使用ehcache存儲和檢索數據的Web應用程序。對我而言,以下配置對我來說工作正常。GAE是否支持EHCache的寫後操作?
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" >
<cacheManagerEventListenerFactory class="" properties=""/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
memoryStoreEvictionPolicy="LRU">
<!-- <persistence strategy="none"/> -->
</defaultCache>
<cache name="st"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>
但引入後寫操作後,我得到以下錯誤。
配置:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd" >
<cacheManagerEventListenerFactory class="" properties=""/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
memoryStoreEvictionPolicy="LRU">
<!-- <persistence strategy="none"/> -->
</defaultCache>
<cache name="st"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LRU"
>
<!-- <persistence strategy="none"/> -->
<cacheWriter writeMode="write-behind" maxWriteDelay="8" rateLimitPerSecond="5"
writeCoalescing="true" writeBatching="true" writeBatchSize="20"
retryAttempts="2" retryAttemptDelaySeconds="2">
<cacheWriterFactory class="com.gowtham.st.shared.STWriterFactory" />
</cacheWriter>
</cache>
</ehcache>
錯誤:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sT' defined in file [/base/data/home/apps/s~google-test-40392/1.383872259417297841/WEB-INF/classes/com/gowtham/st/server/ST.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.gowtham.st.server.ST]: Constructor threw exception; nested exception is java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
是否有任何其他的方式來實現這一目標?
這是如何工作的?除非這個緩存由memcache備份,否則不會工作。您可以使用本地緩存實施。 – jirungaray