作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
试图让这个简单的演示在 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.
关于tomcat7 - Tomcat 错误 : java. lang.IllegalStateException:调用 [asyncPostProcess()] 对具有异步状态 [STARTED] 的请求无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16856119/
试图让这个简单的演示在 tomcat 7.0.37 上运行: https://github.com/cometd/cometd-tutorials/tree/master/client-hello 我
我是一名优秀的程序员,十分优秀!