2013-04-26 2 views
1

J'utilise Ehcache version 2,7Ehcache ne permet pas l'élément de persistance

pom.xml

<dependency> 
    <groupId>net.sf.ehcache</groupId> 
    <artifactId>ehcache</artifactId> 
    <version>2.7.0</version> 
</dependency> 

contexte cache.xml

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:cache="http://www.springframework.org/schema/cache" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:p="http://www.springframework.org/schema/p" 
xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/cache 
    http://www.springframework.org/schema/cache/spring-cache.xsd"> 

<!-- generic cache manager --> 
<cache:annotation-driven /> 

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" 
p:cacheManager-ref="ehcache"/> 

<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" 
    p:configLocation="classpath:ehcache.xml" p:shared="true" /> 

ehcache.xml

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="true" 
monitoring="autodetect" dynamicConfig="true"> 

    <defaultCache eternal="true" maxElementsInMemory="100" overflowToDisk="false" /> 
    <cache name="AC" maxElementsInMemory="50000" eternal="true" overflowToDisk="false"> 
     <persistence strategy="localRestartable" synchronousWrites="false" /> 
    </cache> 

</ehcache> 

Je reçois l'exception suivante

org.xml.sax.SAXException: null:9: Element <cache> does not allow nested <persistence> elements. 

Même si elle est autorisée dans http://ehcache.org/ehcache.xsd

<xs:element minOccurs="0" maxOccurs="1" ref="persistence"/> 

Je ne reçois pas ce qui peut causer ce problème et pourquoi SAX se plaint environ persistence pas autorisé. Qu'est-ce que je fais mal?

Répondre

4

Il s'est avéré que j'avais hibernate ehcache chargé dans mon pom.xml qui est en conflit avec ehcache 2.7.0. Après avoir supprimé cette dépendance, tout a bien fonctionné. Un autre 4 heures valeur dépenser entièrement :(

Questions connexes