users@grizzly.java.net

Re: FW: Grizzly Comet hasn't been registered

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 07 Jan 2008 10:48:57 -0500

Hi,

sorry for the delay...not sure if you have found your problem. You get
that exception because your CometContext is not registered correctly,
meaning when you invoke:

CometEngine.getEngine().register(contextPath);

the contextPath must be the request url that will enable the CometEngine:

As an example, if you do:

CometEngine.getEngine().register("/grizzlyComet");

all requests to

http://ip:port/grizzlyComet/

will be considered as a Comet request. Hence you need to make sure the
Servlet mapped to the url is the one that handle Comet so when you invoke:

addCometHandler(..), the CometEngine has been properly started. Just
send me your web.xml/Servlet so I can take a look.

Thanks!

--Jeanfrancois




John C. Turnbull wrote:
> I should add that I am using SJSAS 9.1_01 if that is relevant.
>
> Also, trying:
>
> http://localhost:8080/examples/ChatServlet
>
> does not produce the exception... it does absolutely nothing instead.
> What's the correct way to run this example?
>
> Thanks,
>
> -JCT
>
> -----Original Message-----
> From: John C. Turnbull [mailto:ozemale_at_ozemail.com.au]
> Sent: Friday, 4 January 2008 11:33
> To: 'users_at_grizzly.dev.java.net'
> Subject: RE: Grizzly Comet hasn't been registered
>
> Here it is:
>
> StandardWrapperValve[ChatServlet]: PWC1406: Servlet.service() for servlet
> ChatServlet threw exception
> java.lang.IllegalStateException: Grizzly Comet hasn't been registered
> at
> com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:220)
> at
> com.sun.grizzly.comet.CometContext.addCometHandler(CometContext.java:266)
> at com.john.ChatServlet.doPost(ChatServlet.java:88)
> at com.john.ChatServlet.doGet(ChatServlet.java:44)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
> at
> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFi
> lterChain.java:411)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:290)
> at
> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
> Valve.java:271)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:202)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
> )
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
> )
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :150)
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
> )
> at
> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
> )
> at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
> at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
> at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
> at
> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(
> DefaultProcessorTask.java:637)
> at
> com.sun.enterprise.web.connector.grizzly.comet.CometEngine.executeServlet(Co
> metEngine.java:547)
> at
> com.sun.enterprise.web.connector.grizzly.comet.CometEngine.handle(CometEngin
> e.java:299)
> at
> com.sun.enterprise.web.connector.grizzly.comet.CometAsyncFilter.doFilter(Com
> etAsyncFilter.java:87)
> at
> com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.invokeFi
> lters(DefaultAsyncExecutor.java:175)
> at
> com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.interrup
> t(DefaultAsyncExecutor.java:153)
> at
> com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(Asy
> ncProcessorTask.java:92)
> at
> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
> at
> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerTh
> read.java:106)
>
> Line 88 of ChatServlet is:
>
> cometContext.addCometHandler(handler);
>
> Thanks,
>
> -JCT
>
>> -----Original Message-----
>> From: Shing-Wai.Chan_at_Sun.COM [mailto:Shing-Wai.Chan_at_Sun.COM]
>> Sent: Friday, 4 January 2008 09:57
>> To: users_at_grizzly.dev.java.net
>> Subject: Re: Grizzly Comet hasn't been registered
>>
>> Do you have stack trace?
>>
>> John C. Turnbull wrote:
>>> I am trying to implement the chat example that Jean-Francois used in
>>> his blog but I get this exception in the same place that other people
>>> have reported it in the past (namely
>>> cometContext.addCometHandler(handler); in doPost()) only I have
>>> checked that the context used to invoke the servlet is the same as
>>> that in its mapping configuration. I am using the latest Grizzly.
>>>
>>> Are there other possible reasons for getting this exception? The
>>> servlet mapping is "/ChatServlet" and the code to register it is:
>>>
>>> contextPath = config.getServletContext().getContextPath() +
>>> "/ChatServlet";
>>>
>>> The chat.jsp used to invoke the servlet has:
>>>
>>> <frameset>
>>>
>>> <iframe src ="/examples/ChatServlet?action=openchat" name="CometChat"
>>> width="100%" scrolling="auto"> </iframe>
>>>
>>> <iframe name="post" src="post.jsp" width="100%" scrolling="no"/>
>>>
>>> </frameset>
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>>
>>> -JCT
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>