2012-06-11 30 views
8

Tôi đang thử nghiệm bộ nhớ cache mùa xuân và cấu hình Cache, đây là tập tin bối cảnh của tôimùa xuân 3.1.1 và vấn đề

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

tôi đã thêm tất cả các thư viện cần thiết nhưng, tôi không thể xác nhận thư viện vì Eclipse vẫn nói với tôi rằng AOPAlliance.jar và org.springframework.context-3.1.1.RELEASE.jar bị thiếu.

Lỗi này là:

Nhiều chú thích sáng lập tại dòng này: class org.springframework.cache.concurrent.ConcurrentCacheFactoryBean không tìm thấy.

giải quyết thay đổi để org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean

nhưng, kêu gọi các url này sẽ xảy ra:

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 và org.springframework.aop-3.1.1 .RELEASE.jar đều nằm trong classpath.

Bất kỳ đầu mối nào?

Cảm ơn,
Andrea

Trả lời

20

Kiểm tra rằng org.springframework.context-3.1.1.RELEASE.jar thực sự là trên classpath. Cả hai xác thực Eclipse và điểm lỗi tại vấn đề này.

CẬP NHẬT: Tôi đã kiểm tra và bạn nói đúng. ConcurrentCacheFactoryBean dường như bị xóa kể từ 3.1.0.M1 và có thể được thay thế bằng ConcurrentMapCacheFactoryBean trong cùng một gói. Tôi chưa thể tìm thấy bất kỳ bằng chứng nào trong ghi chú phát hành. Tuy nhiên, nếu bạn thay đổi tên lớp bean cho bộ nhớ cache của mình thành ConcurrentMapCacheFactoryBean, có vẻ như nó hoạt động tốt.

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

UPDATE2: Vâng, thực sự ConcurrentCacheFactoryBean đã renamed để ConcurrentMapCacheFactoryBean. Họ chỉ không nhận được xung quanh để cập nhật các hướng dẫn.

+0

Đã xác minh đôi :) Đúng vậy. –

+0

@AndreaGirardi Tôi đã cập nhật câu trả lời của mình – maksimov

+0

Vâng, nó hoạt động, nhưng vẫn là một java.lang.ClassNotFoundException: org.springframework.aop.config.AopNamespaceUtils. Có thể cái gì khác đã được thay đổi? Lớp này có sẵn trên classpath –

Các vấn đề liên quan