错误信息:

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"
	>

参考:

https://blog.csdn.net/caoxiaohong1005/article/details/53401880

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2022-02-07
  • 2021-06-15
  • 2021-09-10
  • 2021-05-16
猜你喜欢
  • 2021-11-28
  • 2021-09-12
  • 2022-01-01
  • 2021-10-20
  • 2021-08-25
  • 2021-12-11
相关资源
相似解决方案