2017-09-14 2 views
0

Ich versuche, die Feder-Cache in Alfresco zu verwenden, aber wenn ich anfangen tomcat Ich erhalte die folgende Ausnahme:Spring Cache in Alfresco

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [alfresco/module/PolmanProject-alfresco-repo/context/service-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 8; cvc-elt.1.a: Cannot find the declaration of element 'beans'. 

Ich habe folgende Modul-Kontext:

?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> 

<beans> 
... 
    <cache:annotation-driven /> 
    <bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager"> 
     <property name="caches"> 
      <set> 
       <bean 
      class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" 
        name="cacheService" /> 
      </set> 
     </property> 
    </bean> 
</beans> 

Wenn ich entfernen und den Bean-Cache-Manager, dann bekomme ich nicht die Ausnahme.

Was ist falsch in meinem Kontext?

Antwort

1

sollten Sie kommentieren die Zeile

<!-- <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> --> 

und den Tag mit

<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:cache="http://www.springframework.org/schema/cache" 
xsi:schemaLocation="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"> 

ersetzen Und das wird Ihr Problem lösen. Es ist jedoch notwendig, andere Details zu berücksichtigen, um den Cache zu verwenden. Dieser Beitrag erklärt how to use the cache step by step

+0

Das behebt mein Problem. Vielen Dank! – Kramer