users@grizzly.java.net

Grizzly Comet hasn't been registered

From: Matthieu Fillon <mfillon_at_gmail.com>
Date: Thu, 22 May 2008 12:00:59 +0200

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("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?

Thanks,
Matthieu Fillon