1. 程式人生 > >Spring配置檔案xml約束出錯

Spring配置檔案xml約束出錯

Multiple annotations found at this line:
- cvc-elt.1: Cannot find the declaration of element 'beans'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans.xsd', because 1) could not 

find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

在寫Spring的配置檔案時候出現這種錯誤。


從網上搜了一些,有的說是因為網路原因訪問不到xsd檔案,因為訪問不到網路上的xsd檔案,我們可以訪問本地的啊,在引入的spring的包中spring-beans-3.2.2.RELEASE.jar中有spring-beans-3.0.xsd檔案,其他的xsd檔案也都能在相應的包中找到,這樣就好說了,把xsd檔案的引用全部改為本地檔案,我們只需要在報錯的地方把www去掉就行了。