I am facing a problem when using Async DeferredResult Long Polling in my web application.
Specifically, I am getting an error "java.lang.IllegalStateException: 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 "true" to servlet and filter declarations in web.xml."
This error is generated when I call one method of my Controller (@Controller) using Ajax call.
My application is set up by using:
- Spring MVC 3.2
- Tomcat 7.0.57
- Servlet 3.0.1
I have followed all the respective instructions regarding web.xml and fulfilled all the servlets and filters with the tag
<async-supported>true</async-supported>
Below you may find all the web.xml
<?xml version="1.0" encoding="UTF-8"?>
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:net/bull/javamelody/monitoring-spring.xml
/WEB-INF/spring/root-context.xml
/WEB-INF/spring/menu-structure.xml
</param-value>
</context-param>
<!-- Java melody filter mapping and listener -->
<filter>
<filter-name>monitoring</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>monitoring</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- Dandelion-Datatables servlet definition -->
<servlet>
<servlet-name>datatablesController</servlet-name>
<servlet-class>com.github.dandelion.datatables.extras.servlet2.servlet.DatatablesServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<!-- Dandelion-Datatables servlet mapping -->
<servlet-mapping>
<servlet-name>datatablesController</servlet-name>
<url-pattern>/datatablesController/*</url-pattern>
</servlet-mapping>
Any suggestions?
Thank you in advance.