atmosphere icon indicating copy to clipboard operation
atmosphere copied to clipboard

comet not working with tomcat7 and atmos 1.0.5

Open hapali opened this issue 13 years ago • 4 comments

I doesnt matter if you have nio connector or bio connector atmosphere-compat-tomcat.jar and atmosphere-compat-tomcat7.jar in lib or not in lib Contect.xml with or without Context.xml

Tomcat log

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@3617a35 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)

hapali avatar Dec 12 '12 14:12 hapali

Just tested with Tomcat 7.0.33 and everything works fine with websocket, long-polling and sse:

Dec 12, 2012 10:58:07 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/jfarcand/workspace/containers/shared_webapps/.autodeploystatus
Dec 12, 2012 10:58:07 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Dec 12, 2012 10:58:07 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 12, 2012 10:58:07 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1037 ms
Dec 12, 2012 10:58:47 AM org.apache.catalina.startup.HostConfig deleteRedeployResources
INFO: Undeploying context [/atmosphere-chat]
Dec 12, 2012 10:58:48 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /Users/jfarcand/workspace/containers/shared_webapps/atmosphere-chat.war
17 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation
29 [localhost-startStop-2] INFO org.atmosphere.cpr.DefaultAnnotationProcessor - Found Annotation in org.atmosphere.samples.chat.ChatAtmosphereHandler being scanned: interface org.atmosphere.config.service.AtmosphereHandlerService
44 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereHandler org.atmosphere.samples.chat.ChatAtmosphereHandler mapped to context-path: /chat
44 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereInterceptor [Atmosphere LifeCycle, org.atmosphere.interceptor.BroadcastOnPostAtmosphereInterceptor@6ac27081] mapped to AtmosphereHandler org.atmosphere.samples.chat.ChatAtmosphereHandler
107 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Auto detecting WebSocketHandler in /WEB-INF/classes/
123 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol 
132 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere is using async support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket running under container: Apache Tomcat/7.0.33
135 [localhost-startStop-2] INFO org.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.
135 [localhost-startStop-2] WARN org.atmosphere.cpr.AtmosphereFramework - No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the HeaderBroadcasterCache.
136 [localhost-startStop-2] WARN org.atmosphere.cpr.AtmosphereFramework - Neither TrackMessageSizeInterceptor or TrackMessageSizeFilter are installed. atmosphere.js may receive glued and incomplete message.
136 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - HttpSession supported: false
136 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
136 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
136 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster
137 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Atmosphere Framework 1.0.5 started.

You can try it using atmosphere-chat.war file (download it from here. Not sure why you have so much trouble....

jfarcand avatar Dec 12 '12 16:12 jfarcand

Please reopen this issue. It is very easy to reproduce it. Deploy chat.war on latest tomcat. Open firefox, goto about:config and disable websocket. Next, open chat in firefox and you see this in the log:

7401 [http-bio-8080-exec-6] 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? 7401 [http-bio-8080-exec-6] WARN org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.Tomcat7BIOSupportWithWebSocket

hapali avatar Dec 12 '12 17:12 hapali

I did try that and it worked just fine. Are you sure your Tomcat installation is clean?

jfarcand avatar Dec 12 '12 17:12 jfarcand

I just found out that it happens only when autoDeploy and deployOnStartup is set to false! When u have extracted war with some context you get this issue.

Unpack chat.war in tomcat webapps directory and try this server.xml:

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
    <Listener className="org.apache.catalina.core.AprLifecycleListener"
        SSLEngine="on" />
    <Listener className="org.apache.catalina.core.JasperListener" />
    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

    <Service name="Catalina">
        <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
            connectionTimeout="20000" redirectPort="8443" />
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
        <Engine name="Catalina" defaultHost="localhost">
            <Host name="localhost" appBase="webapps" unpackWARs="false"
                autoDeploy="false" deployOnStartup="false">
                <Context path="chat" docBase="chat" allowLinking="true"
                    useHttpOnly="false">
                </Context>
            </Host>
        </Engine>
    </Service>
</Server>

hapali avatar Dec 12 '12 19:12 hapali