users@grizzly.java.net

Re: comet

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 18 Sep 2007 10:25:52 -0400

Hi Juan,

Juan Moratilla Peon wrote:
> Hello I'm trying to use grizzly comet in a simple example. I have download
> the example from lasterra Blog (the author is Enrique Rodriguez Lasterra)
> but I get a exception java.lang.IllegalStateException: Grizzly Comet
> hasn't been registered when on the doPost the line
> int handlerId = context.addCometHandler(handler);
> is executed.
> I have followed all the indications given in Jean-Francois Arcand's Blog
> and I haven't found any discordance with the code example. I have also
> writen the following lines in domain.xml
>
> <http-listener acceptor-threads="1" address="0.0.0.0"
> blocking-enabled="false" default-virtual-server="server"
> enabled="true" family="inet" id="http-listener-1" port="8080"
> security-enabled="false" server-name="" xpowered-by="true">
> <property name="cometSupport" value="true"/>
> </http-listener>
>
> but I always get the same exception. I'm using glassfish v2.

Just to makes sure, are you using the latest version (FCS version)?

Has someone
> any idea of which could be the error? I send the war file.

You will get that exception is the registered CometContext token is not
reflecting the context-path used to reach the Servlet. As an example, if
you do:

> 67 ServletContext context = config.getServletContext();
> 68 contextPath = context.getContextPath() + "/long_polling";
> 69
> 70 CometEngine engine = CometEngine.getEngine();
> 71 CometContext cometContext = engine.register(contextPath);
> 72 cometContext.setExpirationDelay(30 * 1000);

Let's say this code is invoked when the servlet mapping is defined as:

> <servlet-mapping>
> <servlet-name>ServletTest</servlet-name>
> <url-pattern>/ServletTest</url-pattern>
> </servlet-mapping>

If you send the following request:

http://localhost:8080/CometTest/ServletTest

and invoke

context.addCometHandler(handler);

The exception will be thrown. Can you make sure you aren't hitting that
scenario?

Thanks!

-- Jeanfrancois





>
> Thanks, greetings
>
> Juan Moratilla Peón
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net