错误信息:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"http://xmlns.jcp.org/xml/ns/javaee":servlet-class, "http://xmlns.jcp.org/xml/ns/javaee":jsp-file, "http:// xmlns.jcp.org/xml/ns/javaee":init-param, "http://xmlns.jcp.org/xml/ns/javaee":load-on-startup, "http:// xmlns.jcp.org/xml/ns/javaee":enabled, "http://xmlns.jcp.org/xml/ns/javaee":async-supported, "http:// xmlns.jcp.org/xml/ns/javaee":run-as, "http://xmlns.jcp.org/xml/ns/javaee":security-role-ref, "http:// xmlns.jcp.org/xml/ns/javaee":multipart-config}' is expected.
解决方法:
在xml文件的“xmlns:xsi”里面加入:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance http://java.sun.com/xml/ns/j2ee:servlet-class http://java.sun.com/xml/ns/j2ee"
最终xml文件头部如下:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance http://java.sun.com/xml/ns/j2ee:servlet-class http://java.sun.com/xml/ns/j2ee" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
参考:
https://blog.csdn.net/caoxiaohong1005/article/details/53401880