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을 다음과 같이 enrache 코드를 찾았습니다 .. configurationFactory 코드
응용 프로그램은 ehcache.xml로드하려고 시도하지만 파일을 찾을 수 없으므로 ehcache-failsafe.xml을로드합니다. Ehcache-failsafe.xml에 충격이있는 것은 무엇입니까?
해결책
로딩 ehcache-failsafe.xml
a 문제 그 자체; 그러나 응용 프로그램에 가장 적합하지 않을 가능성이 높습니다.
Ehcache 개발자가 캐시하려는 것을 알 수있는 방법은 없습니다. 이와 같이 ehcache-failsafe.xml
대부분의 경우 잘 작동하는 "가장 낮은 공통 분모"설정을 제공하려는 분포 시도에 포함됩니다. 특정 요구에 더 적합한 구성을 지정하도록 알림으로 경고를받습니다.
다른 팁
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 년 후, 나의 반응이 다른 사람들을 도울 수 있기를 바랍니다.
Hibernate Change를위한 두 번째 레벨 캐시 제공 업체로 Ehcache를 사용하는 경우 hibernate.cache.provider_configuration_file_resource_path with net.sf.ehcache.configurationResourcename ehcache는 구성을 찾을 수 있습니다.