gpt4 book ai didi

tomcat7 - Tomcat 错误 : java. lang.IllegalStateException:调用 [asyncPostProcess()] 对具有异步状态 [STARTED] 的请求无效

转载 作者:行者123 更新时间:2023-12-01 06:34:03 25 4
gpt4 key购买 nike

试图让这个简单的演示在 tomcat 7.0.37 上运行:
https://github.com/cometd/cometd-tutorials/tree/master/client-hello

我更改了 web.xml 以支持异步调用(cometD 用于长轮询)。

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">

<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.annotation.AnnotationCometdServlet</servlet-class>
<init-param>
<param-name>transports</param-name>
<param-value>org.cometd.websocket.server.WebSocketTransport</param-value>
</init-param>
<init-param>
<param-name>services</param-name>
<param-value>org.cometd.tutorials.ClientHelloService</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>cometd</servlet-name>
<url-pattern>/cometd/*</url-pattern>
</servlet-mapping>

<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>continuation</filter-name>
<filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>continuation</filter-name>
<url-pattern>/cometd/*</url-pattern>
</filter-mapping>

</web-app>

如果我按下按钮向服务器发送一些东西,我会收到以下错误:
java.lang.IllegalStateException: Calling [asyncPostProcess()] is not valid for a request with Async state [STARTED]
at org.apache.coyote.AsyncStateMachine.asyncPostProcess(AsyncStateMachine.java:204)
at org.apache.coyote.AbstractProcessor.asyncPostProcess(AbstractProcessor.java:116)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:593)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

也许有人可以为这个堆栈带来光明?

最佳答案

确保在所有过滤器上都设置为 true。见 http://cometd.org/node/106

The async-supported element should be specified for the CometD servlet and for all filters that may be executed before the CometD servlet such as the CrossOriginFilter.



我遇到这个问题是因为我有一个新添加的过滤器,它与缺少此标签的 Cometd 无关。添加标签解决了问题。

关于tomcat7 - Tomcat 错误 : java. lang.IllegalStateException:调用 [asyncPostProcess()] 对具有异步状态 [STARTED] 的请求无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16856119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com