users@grizzly.java.net

Re: Grizzly Comet hasn't been registered

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 22 May 2008 10:41:37 -0400

Hi,

Matthieu Fillon wrote:
> Hello,
> I'm trying to use Grizzly Comet on Glassfish v2.
> I wrote a simple echo sevlet, but I'm getting an IllegalStateException
> "Grizzly Comet hasn't been registered" when adding a CometHandler.
>
> I did registered the Comet Context in the init() method of the Servlet :
>
> public void init(ServletConfig config) throws ServletException {
> contextPath = config.getServletContext().getContextPath() + "/echo";
>
> logger.info <http://logger.info>("registering Comet Context : "
> + contextPath);
> CometContext context =
> CometEngine.getEngine().register(contextPath);
> context.setExpirationDelay(20 * 1000);
> }
>
> the context path is the sam as the url servlet mapping.
> Here is the code that throws the exception :
>
> @Override
> protected void doGet(HttpServletRequest req, HttpServletResponse
> res) throws ServletException, IOException {
> ...
> CometContext context =
> CometEngine.getEngine().getCometContext(contextPath);
> context.addCometHandler(handler);
> }
>
> In my deployment descriptor, I added
> <load-on-startup>0</load-on-startup> to the Comet Servlet description.
> Can you tell me why I'm getting this exception?

Have you added the following property in domain.xml:

<property name="cometSupport" value="true"/>? Usually this is when the
exception happens. If yes you have added it, just attach your war file
and I will take a look.

Thanks

-- Jeanfrancois



>
> Thanks,
> Matthieu Fillon