(1)这个错误是由于xml文件第一行多了一空行。
解决方法: 删除xml文件后的空行。
错误信息:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
(2) 这个错误是由于缺少了对 beans.ml 文件中的元素 beans 的描述信息。
解决方法: 百度(Google)一下,增加关于 beans 的描述信息。
错误信息:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [ beans.xml ] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
本文介绍了两种常见的Spring框架中XML配置文件的问题及解决方案。一是XML文件首行多余空行导致的错误;二是beans元素未正确声明引发的问题。针对这两种情况提供了具体的解决步骤。
606

被折叠的 条评论
为什么被折叠?



