users@grizzly.java.net

Re: Grizzly Comet hasn't been registered

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 23 May 2008 11:23:32 -0400

H

Matthieu Fillon wrote:
> Hi Jean François,
> thank you for the quick reply.
>
>
> Yes I have added the <property name="cometSupport" value="true"/> to my domain config file.
>
>
> I think I have spotted the problem : for my development, I imported the Grizzly Comet library (which I found on the java.net <http://java.net> maven 2 repo : http://download.java.net/maven/2/com/sun/grizzly/grizzly-comet/1.7.3.3/grizzly-comet-1.7.3.3.jar).
>
>
> As Grizzly is embedded in Glassfish, I first declared the dependancy as provided but when running the webapp, Glassfish couldn't find the classes (com.sun.grizzly.comet.*) so I embedded the libs in my webapp.
> But after looking at the Glassfish libraries (v2 ur2), I found the Comet classes in a different package (com.sun.enterprise.web.connector.grizzly.comet.* in appserver-rt.jar).
>
> So I used the libraries provided with Glassfish for my developpement (by adding the appserver-rt.jar file to my local repo) and now it works fine.
>
> Can you tell me which dependancy I have to declare in my maven2 pom file to properly use the grizzly comet libs embedded in glassfish using an official repo and why the classes are not in the same packages?
>

You need to bootstrap Grizzly 1.0.20 from here:

https://maven-repository.dev.java.net/nonav/repository/grizzly/jars/

Grizzly 1.0.20 is the one embedded in GlassFish v2. Let me know how it goes.

Thanks!

-- Jeanfrancois


>
> Thank you,
> Matthieu Fillon
>
>
>
> 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> <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
>