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   文件中。

原文地址:https://www.cnblogs.com/alisonGavin/p/8650266.html