【发布时间】:2015-06-11 16:49:15
【问题描述】:
我正在使用 Spring、maven 和 Apache Tomcat 7 创建一个 Java Web 项目。在这个项目中,我有一个这样的 web.xml:
<display-name>web</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Servlet de Spring. Definimos el Servlet que recibirá todas las peticiones que
se realizen a la página -->
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-servlet.xml</param-value>
</context-param> -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<absolute-ordering>
<name>encodingFilter</name>
<name>cors</name>
<name>springSecurityFilterChain</name>
<name>FileUploadFilter</name>
</absolute-ordering>
<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>
<filter>
<filter-name>encoding-filter</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>
<filter-name>cors</filter-name>
<filter-class>filters.SimpleCorsFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cors</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<error-page>
<location>/error</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error</location>
</error-page>
当我启动 Tomcat 时,控制台上会出现以下消息:
org.apache.catalina.deploy.WebXml orderWebFragments
Used a wrong fragment name encodingFilter at web.xml absolute-ordering tag!
org.apache.catalina.deploy.WebXml orderWebFragments
Used a wrong fragment name cors at web.xml absolute-ordering tag!
org.apache.catalina.deploy.WebXml orderWebFragments
Used a wrong fragment name springSecurityFilterChain at web.xml absolute-ordering tag!
我已经对 Apache Tomcat 6 进行了同样的尝试,但没有遇到任何问题。 有什么想法吗?
【问题讨论】: