Spring Bean声明错误

时间:2011-04-06 02:28:45

标签: spring

applicationContext.xml代码如上所述:

<?xml version="1.0" encoding="UTF-8"?><beans  
xmlns="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-2.5.xsd" >

上面的错误消息:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from ServletContext resource [/WEB-INF/classes/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

那么,问题是什么以及如何解决错误?谢谢先进!!

1 个答案:

答案 0 :(得分:0)

修改

schema / beans之后应该有一个新的行:

xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" >