如何在tomcat 6上启用NIO/amosphere



我正在tomcat 6上试用氛围,但只有长轮询才有效,而不是websocket。我在控制台输出中收到的消息是

 Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.

任何关于这方面的信息都将不胜感激,感谢

更新:修改web.xml和server.xml后,会出现错误消息,但聊天应用程序总是回到长轮询-我已经尝试了几种不同的.war部署websocket演示,它们的行为都是一样的。

我也试过Tomcat7,但它仍然使用长轮询。

启动的一些日志信息

10:42:30.423 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Installed Default AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support, JSONP Interceptor Support]. Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to disable them.
10:42:30.423 [main] WARN  o.atmosphere.cpr.AtmosphereFramework - No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the HeaderBroadcasterCache.
10:42:30.423 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - HttpSession supported: false
10:42:30.423 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
10:42:30.423 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
10:42:30.423 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Using Broadcaster: org.atmosphere.jersey.JerseyBroadcaster
10:42:30.428 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Atmosphere Framework 1.0.0.beta5 started.
27/08/2012 10:42:30 AM org.apache.coyote.http11.Http11NioProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
27/08/2012 10:42:30 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11568 ms

当聊天客户端连接时

27/08/2012 10:47:57 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector

信息:使用servlet写/读的共享选择器

当发送消息时

10:48:09.256 [http-8080-exec-2] DEBUG o.a.cpr.AsynchronousProcessor - Cancelling the connection for request AtmosphereRequest{ contextPath=/atmosphere-rest-chat servletPath=/chat pathInfo=null requestURI=/atmosphere-rest-chat/chat requestURL=http://mogwai:8080/atmosphere-rest-chat/chat destroyable=true}

在context.xml:中

<?xml版本="1.0"编码="UTF-8"?><上下文><Loader delegate="true"/><上下文>

在server.xml中:

<Connector connectionTimeout="20000" port="8080" 
           protocol="org.apache.coyote.http11.Http11NioProtocol" 
           redirectPort="8443"/>

确保在类路径中只定义了一个CometProcessor实现。如果catalina.jar已绑定,您可能需要将其从webpass中删除。有关更多信息,请参阅此线程:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200707.mbox/%3C11785700.post@talk.nabble.com%3E

最新更新