ehcache警告消息"未找到配置"

nay*_*kam 12 spring hibernate ehcache

应用程序启动时我收到了以下警告.

2009-05-13 09:19:41,171 WARN  net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath:jar:file:/app/java/lib/ehcache-1.1.jar!/ehcache-failsafe.xml  
Run Code Online (Sandbox Code Playgroud)

我在以下url中找到了encache代码.ConfigurationFactory Code

应用程序正在尝试加载ehcache.xml但无法找到该文件,因此它加载了ehcache-failsafe.xml.我想知道这是否会导致应用程序出现任何问题?什么是影响加载ehcache-failsafe.xml?

小智 30

ehcache.xml应该在你的classpath,特别是在WEB-INF/classes/.然后,您可以根据您的环境在其中指定您的需求.

这是一个例子:

<?xml version="1.0" encoding="UTF-8"?>

<ehcache>
    <diskStore path="java.io.tmpdir"/>

    <cache name="org.hibernate.cache.UpdateTimestampsCache"
           maxElementsInMemory="50000"
           eternal="true"
           overflowToDisk="true"/>

    <cache name="org.hibernate.cache.StandardQueryCache"
           maxElementsInMemory="50000"
           eternal="false"
           timeToIdleSeconds="120"
           timeToLiveSeconds="120"
           overflowToDisk="true"
           diskPersistent="false"
               diskExpiryThreadIntervalSeconds="120"
           memoryStoreEvictionPolicy="LRU"
            />

    <defaultCache
            maxElementsInMemory="50000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />

</ehcache>
Run Code Online (Sandbox Code Playgroud)

3年后,希望我的回复可以帮助别人.


Chs*_*y76 10

装载ehcache-failsafe.xml本身不会造成问题 ; 但是,它很可能不适合您的应用.

EhCache开发人员无法知道您打算缓存的内容; 因此,ehcache-failsafe.xml包括在分发尝试中提供一些"最低公分母"设置,在大多数情况下或多或少都可以正常工作.您会收到警告,提醒您指定更适合您特定需求的配置.