Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在tomcat 6上启用NIO/atmosphere_Java_Tomcat_Atmosphere - Fatal编程技术网

Java 如何在tomcat 6上启用NIO/atmosphere

Java 如何在tomcat 6上启用NIO/atmosphere,java,tomcat,atmosphere,Java,Tomcat,Atmosphere,我正在Tomcat6上试用atmosphere,但只有长轮询才有效,而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后,会显示错误

我正在Tomcat6上试用atmosphere,但只有长轮询才有效,而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后,会显示错误消息,但聊天应用程序总是返回到长轮询-我尝试了几种不同的websocket演示的.war部署,它们的行为都相同

我也尝试了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 version="1.0" encoding="UTF-8"?> <Context> <Loader delegate="true"/> </Context> 在server.xml中:

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

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


谢谢你的帮助。配置更改后仍然默认为longpolling(生成路径中没有catalina libs)。你能在日志里看到什么吗?