java-ee – Web.xml:从元素javaee开始找到无效内容

前端之家收集整理的这篇文章主要介绍了java-ee – Web.xml:从元素javaee开始找到无效内容前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在 Eclipse IDE上遇到此错误.
<?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/j2ee" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID" version="2.4">
  <javaee:display-name>Spring Web MVC Application</javaee:display-name>
  <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>mvc-dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>mvc-dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <context-param>
    <javaee:param-name>contextConfigLocation</javaee:param-name>
    <javaee:param-value>/WEB-INF/mvc-dispatcher-servlet.xml /WEB-INF/spring-security.xml</javaee:param-value>
  </context-param>
  <listener>
    <javaee:listener-class>org.springframework.web.context.ContextLoaderListener</javaee:listener-class>
  </listener>

Eclipse问题日志

Description Resource    Path    Location    Type
cvc-complex-type.2.4.a: Invalid content was found starting with element 'javaee:display-name'. One of '{"http://java.sun.com/xml/ns/j2ee":description,"http://java.sun.com/xml/ns/j2ee":display-name,"http://java.sun.com/xml/ns/j2ee":icon,"http://java.sun.com/xml/ns/j2ee":distributable,"http://java.sun.com/xml/ns/j2ee":context-param,"http://java.sun.com/xml/ns/j2ee":filter,"http://java.sun.com/xml/ns/j2ee":filter-mapping,"http://java.sun.com/xml/ns/j2ee":listener,"http://java.sun.com/xml/ns/j2ee":servlet,"http://java.sun.com/xml/ns/j2ee":servlet-mapping,"http://java.sun.com/xml/ns/j2ee":session-config,"http://java.sun.com/xml/ns/j2ee":mime-mapping,"http://java.sun.com/xml/ns/j2ee":welcome-file-list,"http://java.sun.com/xml/ns/j2ee":error-page,"http://java.sun.com/xml/ns/j2ee":jsp-config,"http://java.sun.com/xml/ns/j2ee":security-constraint,"http://java.sun.com/xml/ns/j2ee":login-config,"http://java.sun.com/xml/ns/j2ee":security-role,"http://java.sun.com/xml/ns/j2ee":env-entry,"http://java.sun.com/xml/ns/j2ee":ejb-ref,"http://java.sun.com/xml/ns/j2ee":ejb-local-ref,"http://java.sun.com/xml/ns/j2ee":service-ref,"http://java.sun.com/xml/ns/j2ee":resource-ref,"http://java.sun.com/xml/ns/j2ee":resource-env-ref,"http://java.sun.com/xml/ns/j2ee":message-destination-ref,"http://java.sun.com/xml/ns/j2ee":message-destination,"http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected.   web.xml /cms-web/WebContent/WEB-INF line 3  XML Problem


Description Resource    Path    Location    Type
cvc-complex-type.2.4.a: Invalid content was found starting with element 'javaee:listener-class'. One of '{"http://java.sun.com/xml/ns/j2ee":description,"http://java.sun.com/xml/ns/j2ee":listener-class}' is expected.    web.xml /cms-web/WebContent/WEB-INF line 26 XML Problem

Description Resource    Path    Location    Type
cvc-complex-type.2.4.a: Invalid content was found starting with element 'javaee:param-name'. One of '{"http://java.sun.com/xml/ns/j2ee":description,"http://java.sun.com/xml/ns/j2ee":param-name}' is expected.    web.xml /cms-web/WebContent/WEB-INF line 22 XML Problem

解决方法

它不符合XSD.你应该删除javaee ::
<?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/j2ee" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID" version="2.4">
<display-name>Spring Web MVC Application</display-name>
...
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-dispatcher-servlet.xml /WEB-INF/spring-security.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
原文链接:https://www.f2er.com/java/124505.html

猜你在找的Java相关文章