开发者社区> 问答> 正文

tomcat启动报错

web.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
 
    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
  <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>
              /WEB-INF/*.xml
          </param-value>
  </context-param>
  <listener>
          <listener-class>
              org.springframework.web.context.ContextLoaderListener
          </listener-class>
  </listener>
  <filter>
          <filter-name>encodingFilter</filter-name>
          <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
          <init-param>
              <param-name>encoding</param-name>
              <param-value>UTF-8</param-value>
          </init-param>
  </filter>
  <filter-mapping>
          <filter-name>encodingFilter</filter-name>
          <url-pattern>*.do</url-pattern>
  </filter-mapping>
</web-app>
我用的spring mvc,新配了一个ContextLoaderListener就报错了,错误是:

cvc-elt.1: Cannot find the declaration of element 'web-app'.

展开
收起
a123456678 2016-03-13 14:29:31 1681 0
1 条回答
写回答
取消 提交回答
  • <?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:web="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
            version="2.4">
    2019-07-17 19:02:34
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Apache Tomcat 的云原生演进 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载