2009-11-26 135 views
9

应用程序启动时出现以下警告。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 

我发现encache代码在以下网址.. ConfigurationFactory Code

应用程序试图加载ehcache.xml中却找不到该文件,然后将其加载的Ehcache-failsafe.xml.I想知道这是否导致应用程序出现任何问题?什么是影响加载ehcache-failsafe.xml?

回答

10

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

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

28

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年后,希望我的回答可以帮助别人。

+0

感谢您的时间,我已经离开这个无论如何,我会尝试下次你的建议! – nayakam 2012-04-04 01:43:30

0

这个问题背后的原因是,你没有足够的内存来缓存数据,只需编辑tomcat的/bin/catalina.sh文件并根据需要增加内存。例如我已经增加了1024M的内存。 JAVA_OPTS="-Xms512M -Xmx1024M -XX:PermSize=1024M -XX:MaxPermSize=1024M"

0

如果您正在使用的Ehcache作为Hibernate的变化的二级缓存提供商:hibernate.cache.provider_configuration_file_resource_path与net.sf.ehcache.configurationResourceName 的Ehcache将能够找到您的配置即可。

+0

虽然这并不回答原来的问题。 OP询问了故障安全xml的影响 – Dipto 2017-03-18 20:54:49