2011-09-01 25 views
6

設置了一個新的基於Spring的應用程序後,我遇到了引用模式(http://www.springframework.org/schema/beans/spring-beans -3.0.xsd)在應用程序上下文中。在應用上下文中的Spring Beans Schema的驗證錯誤

appContext.xml

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> 

.... 

</beans:beans> 

錯誤

Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.0.xsd). 

即使我減少配置的最低版本(無任何bean定義),我得到這個錯誤。有人提示有什麼問題嗎?提前致謝!

順便說一句:我使用的是STS 2.7.1

回答

17

也許你有一個錯誤,已經不在那裏,而是從緩存中顯示錯誤消息。出現此錯誤的原因可能是您的applicationContext.xml中包含2.5 xsd和3.0 xsd。您應該能夠通過右鍵單擊它來獲取有關此錯誤的詳細信息(雖然不是特別明確的細節)。

嘗試清理錯誤消息並重新驗證這個最小的文件。

+9

我已經解決了這個問題。這是由一些緩存文件引起的。刪除這些項目後(首選項 - >常規 - >網絡連接 - >緩存),一切按預期工作。 謝謝! – devpg

+2

我遇到了完全相同的問題。對於Spring beans,我使用的是http://www.springframework.org/schema/beans/spring-beans-2.0.xsd,對於AOP,它是http://www.springframework.org/schema/aop/spring-aop- 3.0.xsd。 我只是將aop xsd版本更改爲2.0(與bean相同),問題就解決了。 – santu

2

在Eclipse/STS中,轉到首選項 - >常規 - >網絡連接並刪除有問題的文件。

4

在MyEclipseBlue中,轉到首選項 - >我的Eclipse-> Internet工具 - >緩存並刪除文件

+0

這對我有用。然後我必須右鍵單擊xml文件並選擇「驗證」 –

相關問題