cvc-elt.1:Canot find the declaration of element'beans'

2775 ワード

@(プログラミング)
現象の説明
導入されたeclipseプロジェクトのエラーが発生しました.様々な方法で解決できません.エラーメッセージは以下の通りです.
cvc-elt.1: Cannot find the declaration of element 'beans'
エラーファイルはappication Contect-ehcache.xmlです.
原因分析
引用したスプリングバッグは声明のヘッダファイルのバージョン番号と一致しないので、同じに変更すればいいです.
解決方法
元のヘッダの声明は以下の通りです.
<beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        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-3.1.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"
        default-autowire="byName" default-lazy-init="false">
jarファイルを参照してください.spring-coreは3.2.9バージョンですので、以下のように修正されます.
<beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        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-3.2.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.2.xsd"
        default-autowire="byName" default-lazy-init="false">
次の三つの住所を調べてみました.
http://www.springframework.org/schema/beans/
http://www.springframework.org/schema/context/
http://www.springframework.org/schema/cache/
まだだめです
上記の手順で修正した後もエラーが発生しました.cleanがcompleでもエラーが発生しました.以上の内容を修正するのが一番簡単になります.eclipseはもう間違えないようにして、また直します.一番簡単なバージョンは以下の通りです.
<beans
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:cache="http://www.springframework.org/schema/cache"
>