Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.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
Hibernate “ehcache警告消息”;未找到任何配置";_Hibernate_Spring_Ehcache - Fatal编程技术网

Hibernate “ehcache警告消息”;未找到任何配置";

Hibernate “ehcache警告消息”;未找到任何配置";,hibernate,spring,ehcache,Hibernate,Spring,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 我在下面的url中

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

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中找到了兑现代码


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

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


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

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\u configuration\u file\u resource\u path with net.sf.Ehcache.configurationResourceName
Ehcache将能够找到您的配置。

但这并不能回答最初的问题。OP询问了故障保护xml的影响