2012-06-11 8 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> 

私はEclipseがまだあることを私に伝えますので、私は、ライブラリを検証することはできません、すべての必要なライブラリを追加しましたが、 AOPAlliance.jarおよびorg.springframework.context-3.1.1.RELEASE.jarがありません。

エラーは次のとおりです。

複数の注釈このラインで創設:クラスが見つかりませんorg.springframework.cache.concurrent.ConcurrentCacheFactoryBean。

は、この問題が発生したURLを呼び出し、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がクラスパスに実際にあることを再確認してください。 Eclipseの検証とこの問題のエラー・ポイントの両方。

更新:確認しました。あなたは正しいです。 ConcurrentCacheFactoryBeanは3.1.0.M1から削除されている可能性があり、同じパッケージ内にConcurrentMapCacheFactoryBeanと置き換えられている可能性があります。私はまだリリースノートで何か証明を見つけることができませんでした。ただし、キャッシュのBeanクラス名をConcurrentMapCacheFactoryBeanに変更すると、正常に動作するように見えます。

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

アップデート2:はい、確かにConcurrentMapCacheFactoryBeanrenamedConcurrentCacheFactoryBeanてきました。彼らはチュートリアルを更新するために回っていませんでした。

+0

ダブル検証済みです。 –

+0

@AndreaGirardi私の回答を更新しました – maksimov

+0

うん、それは動作しますが、それでもjava.lang.ClassNotFoundException:org.springframework.aop.config.AopNamespaceUtils。他の何かが変更されている可能性はありますか?クラスはクラスパスで利用可能です –

関連する問題