打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
spring 配置文件 beans属性声明部分网络原因 引用不到 saxpasexml exception 解决方法

Exception in thread “main” org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 

Line 10 in XML document from class path resource [app-config.xml] is invalid; 

nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element ‘beans’.

然后去看看app-config.xml里的schema声明部分,是这样写的:

<beans xmlns=”http://www.springframework.org/schema/beans”

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xmlns:context=”http://www.springframework.org/schema/context”

xsi:schemaLocation=”http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-3.0.xsd” >

很明显,有关’beans’的声明都放在http://www.springframework.org/schema/beans/spring-beans-3.0.xsd里面了。可能是网络原因,访问不倒导致解析app-config.xml失败,致使程序抛出异常。

打开spring-beans-3.0.1.RELEASE.jar一看,那个xsd文件就在org.springframework.beans.factory.xml包下面,这下子好办了,把xsd文件的引用全改为本地的就行了:

<beans xmlns=”http://www.springframework.org/schema/beans”

xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xmlns:context=”http://www.springframework.org/schema/context”

xsi:schemaLocation=”http://www.springframework.org/schema/beans

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

http://www.springframework.org/schema/context

classpath:/org/springframework/context/config/spring-context-3.0.xsd” >

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
spring自带的定时任务功能,基于注解和xml配置
Spring 3 MVC and JSON example
SpringMVC 基础教程 简单入门实例
Spring Bean中如何获取ApplicationContext
springMVC 文件上传(一)
maven搭建springmvc+spring+mybatis实例
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服