users@glassfish.java.net

Re: Still Fighting Comet

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 22 May 2007 10:34:37 -0400

Hi,


glassfish_at_javadesktop.org wrote:
> I'm trying to get the Comet example going. I've now solved all of my path and build issues (using comet-1.5.0.jar and associated jars) but now have a problem running.
>
> Whenever I run, I get a
>
> "Grizzly Comet hasn't been registered" error from
>
> cometContext.addCometHandler(handler);
>
> Investigating further, it seems to be caused by the CometEngine returning a null SelectionKey from its activateContinuation method. This in turn seems to be because it looks for the current thread in threadsId and none have been put there. They're meant to be put there by the handle method, which I don't seem to be calling.
>
> When should that method be called and any idea why I'm failing to call it when using J.F. Arcand's demo?

Let's see if we can make it work with the latest GlassFish build without
any needs to use the comet 1.5 implementation (which is targeted to
GlassFish v3 and embedded Grizzly impl. btw).

Now I need more information about when you are calling [
cometContext.addCometHandler(handler) ]. Calling addCometHandler() means
the continuation will be enabled on the current connection (most
probably a GET). You are getting the exception probably because your
context path is not mapping your registered CometContext. Mainly,
something like:

CometContext ctx = CometEngine.getEngine().register("/ABC");

*all* requests taking the form of:

/ABC/DEF
/ABC/comet
...

will enable the continuation (or asynchronous request processing
mechanism), hence you can call addCometHandler() on that connection. But
if you issue:

/AnotherPath/

and this path reach the Servlet where you are calling addCometHandler(),
you will get the exception listed above.

Hope that help.

Thanks

-- Jeanfrancois



> [Message sent by forum member 'gseel' (gseel)]
>
> http://forums.java.net/jive/thread.jspa?messageID=218321
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>