Async support must be enabled on a servlet and for all filters involved in async request processing

原文链接 : https://blog.csdn.net/xxwd12/article/details/100119141

一、报错日志

java.lang.IllegalArgumentException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "<async-supported>true</async-supported>" to servlet and filter declarations in web.xml. Also you must use a Servlet 3.0+ container

二、解决办法

1、修改web.xml头部信息,是因为<async-supported>true</async-supported>是web.xml 3.0的新特性,所以更改web.xml头部文件如下即可,如果是跳过:

<?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/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

2、添加<async-supported>true</async-supported> 

  在web.xml中对DispatcherServlet和所有filter添加 :<async-supported>true</async-supported> 

3、如果集成了shiro一定要注意在mapping中增加dispatcher项,否则会抛org.apache.shiro.UnavailableSecurityManagerException异常

<filter-mapping>
  <filter-name>shiroFilter</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>ASYNC</dispatcher>
</filter-mapping>

 

posted on 2020-11-09 14:58  BestCoding  阅读(838)  评论(0编辑  收藏  举报