14

I have got following warning when the application start up.

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  

I found encache code in following url .. ConfigurationFactory Code

Application is trying to load ehcache.xml but could not find the file so then it loads ehcache-failsafe.xml.I would like to know does this cause any problem to application ? what is impact loading ehcache-failsafe.xml ?

Cœur
  • 37,241
  • 25
  • 195
  • 267
nayakam
  • 4,149
  • 7
  • 42
  • 62

3 Answers3

34

ehcache.xml should be introduced in your classpath and specifically in WEB-INF/classes/. Then, you can specify your needs in it according to your environment.

This is an example:

<?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>

After 3 years, hope that my response can help others.

Igor
  • 33,276
  • 14
  • 79
  • 112
Oueslati Bechir
  • 962
  • 2
  • 10
  • 15
12

Loading ehcache-failsafe.xml doesn't cause a problem per se; however it most likely isn't optimal for your application.

There's no way for EhCache developers to know what you intend to cache; thus ehcache-failsafe.xml included in distribution attempts to provide some "lowest common denominator" settings that would work more or less OK in most cases. You get a warning as a reminder to specify configuration that would be more appropriate for your specific needs.

ChssPly76
  • 99,456
  • 24
  • 206
  • 195
0

If you re using Ehcache as a second level cache provider for hibernate change : hibernate.cache.provider_configuration_file_resource_path with net.sf.ehcache.configurationResourceName Ehcache will be able to find your configuration then.

Meriam
  • 181
  • 2
  • 3
  • This does not answer the original question though. The OP asked about the impact of the failsafe xml – Dipto Mar 18 '17 at 20:54