maven web项目的web.xml报错The markup in the document following the root element must be well-formed.

maven项目里面的web.xml开头约束是这样的

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5" />

当在后面加了东西就会报错:

The markup in the document following the root element must be well-formed.

翻译下错误:根元素后面的文档中的标记必须很好地形成。

解决方法:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5" ><!--这里的“/”代表当前标签结束啊啊啊啊-->
</web-app>

 

posted @ 2018-08-05 10:38  松油灯  阅读(15875)  评论(1)    收藏  举报