代码之家  ›  专栏  ›  技术社区  ›  nayakam

ehcache警告消息“未找到配置”

  •  10
  • nayakam  · 技术社区  · 15 年前

    当应用程序启动时,我收到以下警告。

    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  
    

    我在下面的URL中找到了封装代码。 ConfigurationFactory Code

    应用程序正在尝试加载ehcache.xml,但找不到该文件,因此它将加载ehcache failsafe.xml。我想知道这是否会给应用程序带来任何问题?加载ehcache-failsafe.xml的影响是什么?

    3 回复  |  直到 6 年前
        1
  •  10
  •   ChssPly76    15 年前

    加载 ehcache-failsafe.xml 不会引起 问题 从本质上讲,它很可能不适合您的应用程序。

    ehcache开发人员无法知道您要缓存什么;因此 ehcache-failsafe.xml文件 在发行版中,尝试提供一些“最小公分母”设置,在大多数情况下,这些设置或多或少都可以正常工作。您会收到一条警告,提醒您指定更适合您特定需求的配置。

        2
  •  28
  •   Igor luckyamit    11 年前

    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>
    

    三年后,希望我的反应能帮助别人。

        3
  •  1
  •   Meriam    8 年前

    如果要将ehcache用作二级缓存提供程序进行休眠更改:hibernate.cache.provider_configuration_file_resource_path with net.sf.ehcache.configurationresourcename ehcache将能够找到您的配置。