spring 装配容器失败- org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException


问题1. 

Context initialization failed

     org.springframework. beans.factory.xml.XmlBeanDefinitionStoreException:Line 1 in XML document from 
file [spring-wlf.xml] is invalid;nested exception is org.xml.sax.SAXParseException:The processing instruction
target matching "[xX][mM][1L]” is not allowed.

 

原因: spring.xml中的文件第一行出现空格: 

 空格<?xml version="1.0" encoding="UTF-8"?>

解决:   删除空格

 

问题2: 

nested exception is og.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 47; cvc-elt.1: 找不到元素 'beans' 

原因:  <bean 中的命名空间错误,

解决:

到本地的spring-beans.jar或者spring-content.jar中查找,  找到  spring-schemas中的命名空间。

然后复制相应的xmlns等命名空间到spring.xml   文件中。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM