Skip to main content

Still Fighting Comet

3 replies [Last post]
gseel
Offline
Joined: 2007-05-21

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?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gseel
Offline
Joined: 2007-05-21

Jeanfrancois - thanks for the response.

At present I am using

- Sun Java Application Server 9 (= Glassfish 1?)
- comet-1.5.0.jar and the other associated jars
- your sample chat app from your blog (unaltered except to add a few diagnostic printouts)

Once I get that working, the aim is to develop a football score update application that pushes updates (goals, substitutions etc.) because our current site gets overwhelmed with refreshes near the end of important games!

Sounds like I should retry with Glassfish 3 as things seem to have moved on since your original blog? Should your demo still work if the environment is set up right or does it need an update?

Thanks again.

Jeanfrancois Arcand

Hi,

glassfish@javadesktop.org wrote:
> Jeanfrancois - thanks for the response.
>
> At present I am using
>
> - Sun Java Application Server 9 (= Glassfish 1?)
> - comet-1.5.0.jar and the other associated jars
> - your sample chat app from your blog (unaltered except to add a few diagnostic printouts)

I doubt it will work with GlassFish v1 (you really needs v2) as the
package has been renamed from com.sun.enterprise.web.connector to
com.sun.grizzly in 1.5.

>
> Once I get that working, the aim is to develop a football score update application that pushes updates (goals, substitutions etc.) because our current site gets overwhelmed with refreshes near the end of important games!

Hey hey :-) Comet is quite popular with games. At AjaxWorld this year, I
saw a chess game based on Grizzly Comet. Nothing fancy but knowing it is
just javascript and comet, this is interesting. I need to improve my
JavaScript skills to write such application myself :-)

>
> Sounds like I should retry with Glassfish 3 as things seem to have moved on since your original blog? Should your demo still work if the environment is set up right or does it need an update?

You need to use GlassFish v2 (not v1 nor v3). V2 is our next major release:

https://glassfish.dev.java.net/downloads/v2-b47.html

Just enable Comet and the example will works as it is. I can also share
Ajax related examples if you want to see how Comet works with the
behavior.js (no iframe) library. Just send me an offline email
jeanfrancois.arcand at sun dot com.

Thanks!

-- Jeanfrancois

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Jeanfrancois Arcand

Hi,

glassfish@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@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net