Java中的Asyc支持
我正在创建一个类似于使用DeferredResult进行异步处理的地方。我发现了错误Java中的Asyc支持,java,spring,asynchronous,Java,Spring,Asynchronous,我正在创建一个类似于使用DeferredResult进行异步处理的地方。我发现了错误 HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is
HTTP Status 500 - Request processing failed; nested exception is 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.
我选择java方式是因为我无法编辑我的web.xml文件。因此,我在root-context.xml文件中有一个bean,如下所示:
<bean id="asyncSupport" class="packagename.AsyncSupport"></bean>
它似乎不起作用。还是同一个问题。我做得对吗?如何解决此问题?在servlet配置的web.xml中,您必须将async Supopted设置为true
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/webmvc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
拦截器
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
类路径:spring/webmvc-config.xml
1.
真的
在servlet配置的web.xml中,您必须将async Supopted设置为true
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/webmvc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
拦截器
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
类路径:spring/webmvc-config.xml
1.
真的
错误消息抱怨未配置servlet和筛选器,并告诉您必须执行的操作。但是您正在发布一段不相关的XML和Java代码,这不会使servlet和筛选器异步。错误消息会抱怨未配置servlet和筛选器,并告诉您必须执行的操作。但是您发布的是一段不相关的XML和Java代码,这不会使servlet和过滤器异步。