You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Winter <an...@gmail.com> on 2013/01/22 17:52:37 UTC

Comet problem - 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
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();
    ConsolidatedActionCenterBase.setCAC(this);
    EventLog.append("ConsolidatedActionCenterPush: init" );
    //    queues = new HashMap<String, WorkQueue>();

  }





  @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

Re: Comet problem - HTTP method GET is not supported by this URL

Posted by Andrew Winter <an...@gmail.com>.
> 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
> > Am I doing something wrong?
> >
> > Thanks!
> >
> > Code snippet:
> >
> > public class ConsolidatedActionCenterPush extends HttpServlet  implements
> > CometProcessor,CAC{
> >
> >   private static MessageSender messageSender = null;
>
> static ??
>

> >   private static final Integer TIMEOUT = 600 * 1000;
> >
> >   @Override
> >   public void destroy() {
> >     messageSender.stop();
> >     messageSender = null;
>
> This would break if there is more than 1 instance of your servlet.
>

Thank you for drawing my attention to this potential issue.  Perhaps I need
to verify an assumption of mine: I am thinking that since I am not using a
distributed environment there will only be one instance of this servlet.
 If you want the long story: This is an intranet application and this piece
is used for sending messages to the users. As such there are other threads
that use the static methods to add messages.  In the past when I had the
clients polling on an interval it would not have mattered if an instance
came or went. I will reconsider what I have done here.


> What filters do you have in the request processing chain for this
> servlet? Do they support Comet? (I do not remember whether it is
> important for Comet. Just guessing).
>
> You can use "new Exception().printStackTrace()" to check what valves
> and filters are active for you.
>

Thank you so much!  Looking at my stack trace I saw something that made me
suspicious.  The invoker servlet.  I needed this as we have an mountain of
servlets that have always been called via the package name in the URL.
 Once I removed this the Comet functionality worked!  So I guess I will be
mapping a lot of servlets in the days to come, but it works so cool.

Re: Comet problem - HTTP method GET is not supported by this URL

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/1/22 Andrew Winter <an...@gmail.com>:
> 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
> Am I doing something wrong?
>
> Thanks!
>
> Code snippet:
>
> public class ConsolidatedActionCenterPush extends HttpServlet  implements
> CometProcessor,CAC{
>
>   private static MessageSender messageSender = null;

static ??

>   private static final Integer TIMEOUT = 600 * 1000;
>
>   @Override
>   public void destroy() {
>     messageSender.stop();
>     messageSender = null;

This would break if there is more than 1 instance of your servlet.

>   }
>

What filters do you have in the request processing chain for this
servlet? Do they support Comet? (I do not remember whether it is
important for Comet. Just guessing).

You can use "new Exception().printStackTrace()" to check what valves
and filters are active for you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Comet problem - HTTP method GET is not supported by this URL

Posted by Andrew Winter <an...@gmail.com>.
Here is the NIO connector:

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

Normal servlet requests work, just not the Comet.

After I sent this email, I installed the APR  and switched back to the
standard connector:
<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="9192" />

The log then showed that the APR connector was being used, but I get the
same message when I try to use the comet servlet.

Thank you!


On Thu, Jan 24, 2013 at 2:45 PM, Mark Thomas <ma...@apache.org> wrote:

> On 22/01/2013 16:52, Andrew Winter wrote:
> > 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
> > Am I doing something wrong?
>
> NIO Connector config from server.xml?
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Comet problem - HTTP method GET is not supported by this URL

Posted by Mark Thomas <ma...@apache.org>.
On 22/01/2013 16:52, Andrew Winter wrote:
> 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
> Am I doing something wrong?

NIO Connector config from server.xml?

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org