Failed using comet support with tomcat NIO connector
atmosphere-runtime 1.0.5
[http-nio-8080-exec-7] WARN org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled. If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar Is the Nio or Apr Connector enabled? [http-nio-8080-exec-7] WARN org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.Tomcat7BIOSupportWithWebSocket
NIO connector is enabled! I want comet support! If I remove atmosphere-compat-tomcat.jar I get this exception:
SEVERE: Servlet threw load() exception
java.lang.ClassNotFoundException: org.apache.catalina.CometProcessor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1190)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1136)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
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)
You are missing one dependency (atmosphere-compat-tomcat.jar and atmosphere-compat-tomcat7.jar)
It is very strange: first I have both dependencies and I get the warning that I have to remove atmosphere-compat-tomcat.jar in order to have comet support. Then I remove the dependency and I get ClassNotFoundException. And now u r telling me that I am missing two dependencies?
Don't remove anything, and make sure you read this
I dont get it. I DONT exclude any dependency. I have context.xml in /META-INF and start tomcat. Start firefox and disable websockets and connect. I get this warning:
[http-nio-8080-exec-8] WARN org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled. If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar Is the Nio or Apr Connector enabled? [http-nio-8080-exec-8] WARN org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.Tomcat7BIOSupportWithWebSocket
My context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Loader delegate="true"/>
</Context>
By the way, do you see any advantages to use nio connector instead of bio connector in combination with websockets?
Turn the log on TRACE to see what's the real error. An exception occured for sure.
See line 6:
Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader findClass FINE: findClass(org.apache.coyote.http11.upgrade.UpgradeInbound) Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader findClass FINER: findClassInternal(org.apache.coyote.http11.upgrade.UpgradeInbound) Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader findClass FINER: --> Passing on ClassNotFoundException Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader loadClass FINE: Delegating to parent classloader at end: org.apache.catalina.loader.StandardClassLoader@3617a35c Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader loadClass FINE: Loading class from parent 64183 [catalina-exec-16] WARN org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled. If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar Is the Nio or Apr Connector enabled? 64186 [catalina-exec-16] WARN org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.Tomcat7BIOSupportWithWebSocket Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader loadClass FINE: loadClass(org.atmosphere.util.Utils, false) Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader loadClass FINE: Searching local repositories Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader findClass FINE: findClass(org.atmosphere.util.Utils) Dec 12, 2012 9:06:21 AM org.apache.catalina.loader.WebappClassLoader findClass FINER: findClassInternal(org.atmosphere.util.Utils)
Standalone tomcat 7.0.33 log with BIO connector. Same story with NIO connector.
Can you debug and see which class is missing?
I have a similar error:
2013-08-15 22:44:46,221 [http-nio-8080-exec-10] WARN cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the AtmosphereCometNativeServlet in order to use native Comet Support
@jfarcand The documentation is very unclear here. Can you please make it more clear?
What do we have to do here?
@hapali Did you find any solution?
@confile For me the problem had to do with unpacked war. Tomcat didn't use/read delegate="true" in context.xml because there was no war file but a unpacked war file in my webapps directory. If there is a war file in your webapps directory and you set delegate="true" in context.xml and NIO connector is enabled correctly, it should work.
@hapali no this is not the case. I have an unpacked war file in my tomcat and I have the context.xml in web.inf and meta-inf. It is a problem with the atmosphere framework. By the way it works with atmosphere-runtime-native.jar but not with atmosphere-runtime.jar
I got exactly the same problem as hapali. And here are the detailed message in TRACE:
20:28:36.726 [Thread-2] INFO o.atmosphere.cpr.AtmosphereFramework -
Current version of Atmosphere 1.0.15
Newest version of Atmosphere available 2.0.0.RC3
20:28:36.733 [Thread-2] TRACE o.a.u.a.JGoogleAnalyticsTracker - JGoogleAnalytics: Tracking synchronously focusPoint=AtmosphereFramework-Apache+Tomcat%2F7.0.41
20:28:36.811 [Thread-2] TRACE o.a.util.analytics.HTTPGetMethod - JGoogleAnalytics: Tracking Successful!
20:28:44.043 [http-nio-8080-exec-4] TRACE o.atmosphere.cpr.AtmosphereFramework - Query String translated to headers {X-Atmosphere-Transport=close, X-Atmosphere-tracking-id=e9795cd3-c1a0-41b5-97b5-a4abc81975d2}
20:28:44.046 [http-nio-8080-exec-4] WARN o.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar Is the Nio or Apr Connector enabled?
20:28:44.049 [http-nio-8080-exec-4] TRACE o.atmosphere.cpr.AtmosphereFramework - Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar
java.lang.IllegalStateException: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar
at org.atmosphere.container.Tomcat7CometSupport.
yes, I got same problem as @lyi2012, even turn on NIO
I had similar problem. Now it works with Atmosphere 2.1.6 on Tomcat 7.0.30. In my case I needed to:
- Create file context.xml in webapp/myapp/META-INF. WEB-INF folder is not correct for atmosphere!
- I had to remove atmosphere-runtime-2.1.6.jar from libs.
At libs folder I have below jars: atmosphere-compat-jbossweb-2.0.1.jar atmosphere-compat-tomcat-2.0.1.jar atmosphere-compat-tomcat7-2.0.1.jar atmosphere-runtime-native-2.1.6.jar To use NIO I use tomcat-coyote.jar (in tomcat's libs). Check your server.xml. My contains connector that uses protocol: org.apache.coyote.http11.Http11NioProtocol.
@ananasoft Have you read https://github.com/Atmosphere/atmosphere/wiki/Installing-AtmosphereServlet-with-or-without-native-support?
Yes, I have read. But when I was using 2.1.0 version my configuration was corrupted and NIO was still enabled. After I upgraded to 2.1.6, atmosphere was working with BIO. Problem was related to: https://github.com/Atmosphere/atmosphere/issues/1588 but now my project is configured right. Thanks.