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