10 Replies Latest reply on Aug 5, 2011 8:38 PM by trinity6nine

    Tomcat 6 comet support in 4.2.2

    jon.brisbin

      I was wondering how I go about doing Comet inside a webapp by implementing the catalina CometProcessor interface? When I access a servlet that implements this interface, I get this JBoss-specific error:

      java.lang.ClassCastException: org.jboss.web.tomcat.filters.ReplyHeaderFilter cannot be cast to org.apache.catalina.CometFilter
       org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:887)
       org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:696)
       org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2008)
       java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
       java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
       java.lang.Thread.run(Thread.java:619)


      What do I need to do to get comet support in the Tomcat that comes with JBoss? Replace it with Jetty?

      Thanks!

      Jon Brisbin

        • 1. Re: Tomcat 6 comet support in 4.2.2
          jonasb

          Hi,

          I'm experiencing the same, did you ever get this working?


          / Jonas

          • 2. Re: Tomcat 6 comet support in 4.2.2
            jonasb

            It works with jboss-4.2.0.CR1, but not with 4.2.1 GA...


            / Jonas

            • 3. Re: Tomcat 6 comet support in 4.2.2
              jfclere

              JBossWEB has now it own implementation of Comet the TC6 one can't be used.

              • 4. Re: Tomcat 6 comet support in 4.2.2
                jonasb

                Thanks for answering.

                You're referring to org.jboss.web.comet.CometProcessor, right? But that interface is not available in 4.2.2, I can only find org.apache.catalina.CometProcessor in the jbossweb jar. Also, the rename was made in january this year according to some svn commit log I found, so I guess it's in a later jbossweb than the one bundled with 4.2.2.

                I tried to simply copy catalina.jar from a jbossweb 2.1.0 GA to the jboss-web deployer in my jboss 4.2.2 installation, and my "event" method was called, so I'm guessing that I need to upgrade.
                However, I can't find any documentation on how to properly upgrade the version of jbossweb that is bundled with 4.2.2 to jbossweb 2.1.0. Could you help me out? Would it work to just replace the jbossweb* jars with the jars found in the lib directory of jbossweb-2.1.0?


                Thanks / Jonas

                • 5. Re: Tomcat 6 comet support in 4.2.2
                  jfclere

                   

                  You're referring to org.jboss.web.comet.CometProcessor, right?

                  Yes.

                  Using JBossWEB 2.1.x jar files could help but that is not a supported configuration.

                  The Comet should be in the AS 5.0.x versions but you can use the standalone version.
                  The developers are still discussing the definitive API we will make a JBossWEB release soon.

                  • 6. Re: Tomcat 6 comet support in 4.2.2
                    jonasb

                    Ok, thanks for your time.


                    / Jonas

                    • 7. Re: Tomcat 6 comet support in 4.2.2

                      I got my "hello comet" servlet worked in JBoss 4.2.2 after putting the catalina.jar from jboss-web-2.1.0 but it throws following exception (instead of firing a "EventType.END" event) when I click the "stop" button in my browser. it works nicely in tomcat 6.

                      12:20:37,091 INFO [STDOUT] eventType=BEGIN
                      12:21:00,113 ERROR [CoyoteAdapter] An exception or error occurred in the container during the request processing
                      java.lang.NoSuchFieldError: OPEN_READ
                       at org.apache.catalina.connector.CoyoteAdapter.event(CoyoteAdapter.java:153)
                       at org.apache.coyote.http11.Http11NioProcessor.event(Http11NioProcessor.java:749)
                       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.event(Http11NioProtocol.java:634)
                       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2008)
                       at org.apache.tomcat.util.net.NioEndpoint.processSocket(NioEndpoint.java:1126)
                       at org.apache.tomcat.util.net.NioEndpoint$Poller.cancelledKey(NioEndpoint.java:1376)
                       at org.apache.tomcat.util.net.NioEndpoint$Poller.timeout(NioEndpoint.java:1610)
                       at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1451)
                       at java.lang.Thread.run(Thread.java:595)


                      We are going to build quite a big infrastructure for comet based on this api. So we need to be sure that this is stable.

                      • 8. Re: Tomcat 6 comet support in 4.2.2
                        jfclere

                        As said previously:
                        "JBossWEB has now it own implementation of Comet the TC6 one can't be used."

                        • 9. Re: Tomcat 6 comet support in 4.2.2
                          kenny.stainback

                          I've downloaded JBoss 5.0.0.GA and am trying to use the org.jboss.web.comet.CometProcessor interface, as described in the JBossWeb documentation: http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/2.1.0/aio.html

                          However, I can not find this interface in the JBoss AS 5.0 distribution (I looked in the jbossweb.jar that is bundled with it). Can anyone help me locate it? Is it not in the version of JBoss web shipped with JBoss 5? If not, can I upgrade JBoss Web in JBoss 5 to the version that contains it?

                          • 10. Re: Tomcat 6 comet support in 4.2.2
                            trinity6nine

                            For JBoss 4.2.*, you must comment out a specific filter in the default global web.xml (<JBOSS_HOME>/server/default/deploy/jboss-web.deployer/conf/web.xml):

                            web.xml

                             

                            ...

                            <!-- Comment this out!

                            <filter>

                              <filter-name>CommonHeadersFilter</filter-name>

                              <filter-class>org.jboss.web.tomcat.filters.ReplyHeaderFilter</filter-class>

                              <init-param>

                                <param-name>X-Powered-By</param-name>

                                <param-value>...</param-value>

                              </init-param>

                            </filter>

                             

                            <filter-mapping>

                              <filter-name>CommonHeadersFilter</filter-name>

                              <url-pattern>/*</url-pattern>

                            </filter-mapping>

                            -->