2012-06-11 15 views
8

मैं वसंत कैश का परीक्षण कर रहा हूँ और, यह मेरा प्रसंग फ़ाइलवसंत 3.1.1 और कैश कॉन्फ़िगरेशन समस्या

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

    <cache:annotation-driven cache-manager="simpleCacheManager"/> 

    <bean id="simpleCacheManager" class="org.springframework.cache.support.SimpleCacheManager"> 
     <property name="caches"> 
      <set> 
       <bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean"> 
        <property name="name" value="alfresco"/> 
       </bean> 
       <bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean"> 
        <property name="name" value="alfresco_article"/> 
       </bean> 
       <bean class="org.springframework.cache.concurrent.ConcurrentCacheFactoryBean"> 
        <property name="name" value="alfresco_action"/> 
       </bean> 
      </set> 
     </property> 
    </bean> 

है मैं जोड़ा सभी आवश्यक पुस्तकालय लेकिन, मैं पुस्तकालय मान्य नहीं कर सकता क्योंकि ग्रहण अभी भी मुझे लगता है कि बताता है AOPAlliance.jar और org.springframework.context-3.1.1.RELEASE.jar गुम हैं।

त्रुटि है:

इस लाइन पर एकाधिक एनोटेशन founds: वर्ग नहीं मिला org.springframework.cache.concurrent.ConcurrentCacheFactoryBean।

org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean

के लिए बदल हल लेकिन यूआरएल ऐसा होता है बुला,:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [configuration-context.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/config/AopNamespaceUtils 
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894) 
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 

root cause 

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [configuration-context.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/config/AopNamespaceUtils 
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412) 

aop-alliance.jar और org.springframework.aop-3.1.1 .RELEASE.jar दोनों क्लासपाथ में हैं।

कोई सुराग?

धन्यवाद,
एंड्रिया

उत्तर

20

दो बार जांचें कि org.springframework.context-3.1.1.RELEASE.jar classpath पर वास्तव में है। इस मुद्दे पर एक्लिप्स सत्यापन और त्रुटि बिंदु दोनों।

अद्यतन: मैंने जांच की है, और आप सही हैं। ConcurrentCacheFactoryBean 3.1.0.M1 से हटाया जा रहा प्रतीत होता है और संभवतः उसी पैकेज में ConcurrentMapCacheFactoryBean द्वारा प्रतिस्थापित किया गया है। मैं अभी तक रिलीज नोट्स में कोई सबूत नहीं ढूंढ पाया। हालांकि, अगर आप अपने कैश के लिए बीन क्लास नाम ConcurrentMapCacheFactoryBean पर बदलते हैं, तो यह ठीक काम करता प्रतीत होता है।

<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"> 
    <property name="name" value="alfresco"/> 
</bean> 

UPDATE2: हाँ, वास्तव में ConcurrentCacheFactoryBeanConcurrentMapCacheFactoryBean को renamed किया गया है। वे ट्यूटोरियल को अपडेट करने के लिए अभी नहीं मिल पाए।

+0

डबल सत्यापित :) यह है। –

+0

@AndreaGirardi मैंने अपना उत्तर – maksimov

+0

हाँ अपडेट किया, हाँ, यह काम करता है, लेकिन फिर भी एक java.lang.ClassNotFoundException: org.springframework.aop.config.AopNamespaceUtils। क्या यह संभव है कि कुछ और बदल दिया गया है? कक्षा क्लासपाथ –

संबंधित मुद्दे