spring中的xml配置文件里报错

主要有以下几种:

1. 在eclipse里创建web的maven项目时,如果pom.xml报错,则是因为没有src/main/webapp下没有web.xml文件,在webapp下依次创建META-INF文件夹和WEB-INF文件夹,在WEB-INF里分别创建lib文件夹和web.xml文件。

2. 在eclipse里的spring的配置文件中如果出现以下出错信息:

No grammar constraints (DTD or XML Schema) referenced in the document.

有可能时因为你的<?xml version="1.0" encoding="UTF-8" ?>语句没有在第一行,或者前面有空格

3. 写的spring配置文件中出现

schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.1.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

这类错误,主要意思是找不到对应的xsd文件,解决方法是把xsd的版本改为和你的spring的版本一样就可以了。

 

原文地址:https://www.cnblogs.com/hzh-666/p/11254779.html