Spring加载XSD文件小结(解决nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreE)
来源:互联网 发布:怎么投稿小说知乎 编辑:程序博客网 时间:2024/05/16 00:31
Spring版本如下:
原先项目使用到的Spring版本为2.5,后来升级版本为3.2,对应XML文件中schema引用的XSD标签版本为
后来因为项目统一Spring版本原因,统一回退到Spring 2.5,Spring jar包版本回退到2.5,但是标签还是写的3.2,如下:
这样子就会导致应用启动正常,而访问接口时候出现如下错误:
关键错误信息:nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException
原因分析
<?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-3.2.xsd">
如此配置,Spring会先在本地查找xsd文件,即Spring 2.5的jar中,如下图:
spring-2.5.6/META-INF/spring.schemas
注意此处兼容2.0版本,Spring找不到映射的3.2xsd文件,然后就去外网查,即
访问地址http://www.springframework.org/schema/beans/spring-beans-3.2.xsd获取xsd文件
因为我应用是在内网,故通过外网也走不通了。
心得
保证xsd标签版本小于spring版本(通常等于就可以了),通过外网方式获取xsd的方式不可取,一旦外网断了问题就会暴露。
参考博客:http://blog.csdn.net/bluishglc/article/details/7596118
0 0
- Spring加载XSD文件小结(解决nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreE)
- Spring—nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException
- nested exception is org.springframework.beans.NotWritablePropertyException:
- Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.Be
- nested exception is org.springframework.beans.ConversionNotSupportedException的解决方法
- nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1': Can
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc
- 解决Spring找不到http://www.springframework.org/schema/beans/spring-beans-2.5.xsd的问题
- nested exception is java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add
- Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException:
- Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExce
- SpringBoot启动报错" Unable to start embedded container; nested exception is org.springframework.beans.fa
- Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExc
- org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException
- Spring MVC 项目中配置log4j 出现错误log4j:ERROR Failed to excute sql com.mysql.jdbc.exceptions.jdbc4.MySQLSynt
- 编程,已知字符串:“this is a test of java”.
- QT开发学习资料(3)
- 微信公众平台开发(一) 配置接口
- svn cleanup 失败解决方法
- Spring加载XSD文件小结(解决nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreE)
- Gradle
- 网络协议
- Associations marked as mappedBy must not define database mappings like @JoinTable or @JoinColumn
- Android Multimedia框架总结(五)多媒体基础概念
- 开源日志库Logger的使用
- 将 gdb 用作函数跟踪器 (Function Tracer)
- 最全的技术教程网站
- 图表: 要素构成