Search code examples
tomcatcometnio

Tomcat Comet event not called - HTTP method GET is not supported by this URL


I am trying to implement a Comet process.

Tomcat 6.0.36

Red Hat Enterprise Linux Server release 6.2 (Santiago)

Java 7u11 (32 bit)

I have implemented CometProcessor. I am using the NIO connector. When I try the servlet I get: HTTP method GET is not supported by this URL. The other topics I have found on this matter advise people to make sure they are using the NIO connector. I have. I have also seen recommendations to make sure the catalina.jar was not packaged with the web app. I have checked that also.

Am I doing something wrong?

Thanks!

Code snippet:

public class ConsolidatedActionCenterPush extends HttpServlet  implements CometProcessor,CAC{

  private static MessageSender messageSender = null;
  private static final Integer TIMEOUT = 600 * 1000;

  @Override
  public void destroy() {
    messageSender.stop();
    messageSender = null;
  }

  @Override
  public void init() throws ServletException {
    messageSender = new MessageSender();
    messageSender.start();

  }


  @Override
  public void event(final CometEvent event) throws IOException, ServletException {
    HttpServletRequest request = event.getHttpServletRequest();
    HttpServletResponse response = event.getHttpServletResponse();

 ........

}

From catalina log:

Jan 22, 2013 11:46:19 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in     production environments was not found on the java.library.path:     /usr/jre732/lib/i386/server:/usr/jre732/lib/i386:/usr/lib:/usr/java/packages/lib/i386:/lib:/usr/lib
Jan 22, 2013 11:46:20 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 22, 2013 11:46:20 AM org.apache.coyote.http11.Http11NioProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 22, 2013 11:46:20 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 540 ms
Jan 22, 2013 11:46:20 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 22, 2013 11:46:20 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Jan 22, 2013 11:46:20 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory servlet
Jan 22, 2013 11:46:23 AM org.apache.coyote.http11.Http11NioProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 22, 2013 11:46:23 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:10794
Jan 22, 2013 11:46:23 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/18  config=null
Jan 22, 2013 11:46:23 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3127 ms

From catalina.out:

Jan 22, 2013 11:46:23 AM org.apache.coyote.http11.Http11NioProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 22, 2013 11:46:23 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:10794
Jan 22, 2013 11:46:23 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/18  config=null
Jan 22, 2013 11:46:23 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3127 ms

Solution

  • I solved it. I was using the invoker servlet because we have a lot of un-mapped servlets. Removing the invoker servlet fixed the comet process.