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

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  

我在以下网址中找到了加密码。 ConfigurationFactory Code

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

有帮助吗?

解决方案

加载 ehcache-failsafe.xml 本身不会导致问题;但是,它很可能不适合您的应用。

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

其他提示

应该在 classpath 中引入

ehcache.xml ,特别是在 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年后,希望我的回复可以帮助他人。

如果你使用Ehcache作为hibernate更改的二级缓存提供程序:hibernate.cache.provider_configuration_file_resource_path with net.sf.ehcache.configurationResourceName Ehcache将能够找到您的配置。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top