记录一个Tomcat启动参数修改,导致不识别<async-supported>的问题

来源:互联网 发布:软件界面模糊 编辑:程序博客网 时间:2024/05/17 10:07

web3.0之后新增一个<async-supported>的属性,支持web.xml中filter添加 <async-supported>标签。

标准情况下只要Tomcat7.0+  JDK1.6+就可以支持该功能,然后这次遇到Tomcat启动报无法识别该属性的问题,花费了很长时间定位,这里记录一下原因。


tomcat启动参数中添加的一个参数 : JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true"

就是该参数最终导致了Tomcat无法识别<async-supported>标签,war包启动失败。


在Tomcat官方文档中查询了一下(https://tomcat.apache.org/tomcat-8.5-doc/config/context.html),该参数的解释如下:

The default value of this system property is false.
If this is true the default values will be changed for:
org.apache.catalina.core.
ApplicationContext.GET_RESOURCE_REQUIRE_SLASH
org.apache.catalina.core.
ApplicationDispatcher.WRAP_SAME_OBJECT
org.apache.catalina.core.
StandardHostValve.ACCESS_SESSION
org.apache.catalina.session.
StandardSession.ACTIVITY_CHECK
org.apache.catalina.session.
StandardSession.LAST_ACCESS_AT_START
org.apache.tomcat.util.http.
ServerCookie.STRICT_NAMING
The URIEncoding attribute of any HTTP connector or AJP connector element.
The resourceOnlyServlets attribute of any Context element.
The tldValidation attribute of any Context element.
The useRelativeRedirects attribute of any Context element.
The xmlNamespaceAware attribute of any Context element.
The xmlValidation attribute of any Context element.

在查看具体的解释分析,应该是 resourceOnlyServlets 属性造成了这个问题:
Comma separated list of Servlet names (as used in /WEB-INF/web.xml) that expect a resource to be present. Ensures that welcome files associated with Servlets that expect a resource to be present (such as the JSP Servlet) are not used when there is no resource present. This prevents issues caused by the clarification of welcome file mapping in section 10.10 of the Servlet 3.0 specification. 

先粗略记录一下,有时间再研究

阅读全文
0 0
原创粉丝点击