您的位置:首页 > 其它

Cannot find the declaration of element 'beans'. 的解决方法

2014-08-22 09:09 711 查看
问题:org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.

解决方案:一、如果在项目中遇到该异常,通常是项目无法下载到spring-beans-2.5.xsd文件而出现的问题,这里的版本号因项目版本而异。

这里需要配置本地的xsd文件,方法如下:

找到你的项目中引用的spring的核心包,spring.jar

用压缩文件打开,找到该路径

org/springframework/beans/factory/xml/

并将这个路径下的xsd文件以下列形式配置到applicationContext.xml文件中,如果有多个配置文件,则全部代替

即以

classpath:/org/springframework/beans/factory/xml/spring-beans-2.5.xsd

代替
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
使得从本地直接读取该配置文件

转载地址:http://blog.csdn.net/wengang285/article/details/7587264

二、

修改Spring applicationContext.xml文件XML的命名空间,改为如下代码:

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<beans>


问题解决

转载地址:http://www.myexception.cn/vc-mfc/627052.html

第一个方法貌似没效果,我用第二个才解决问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐