I am a bit confused here.
Are you using comet or cometd?
If it is cometd, then in DataServlet below, I see the following:
String contextPath = "/CometApp/cometd";
CometEngine cometEngine = CometEngine.getEngine();
context = cometEngine.register(contextPath);
context.setExpirationDelay(60 * 1000);
Why do we need to do register it manually?
Note that the /cometd url pattern should associate to the CometdServlet.
Regards,
Shing Wai Chan
Michał Orzechowski wrote:
> Hi,
>
> Thanks for reply. I managed to run my app using
> grizzly-comet-webserver-1.9.0, and my basic problem stands: I can't
> notify javascript subscribesrs with servlet publisher :/. Even after I
> add line Jeanfrancois suggested, it doesn't work. Any help would be
> appreciated.
>
> Thanks
> Michal
>
> Oleksiy Stashok pisze:
>>
>>>
>>> Could you list the jar's that are needed to update grizzly-module?
>>> I have updated grizzly-module with: grizzly-framework, grizzly-http
>>> and grizzly-http-utils (1.9.0), however then Glassfish do not start.
>> I see...
>> Seems like it will not work :( Glassfish core classes rely on old
>> Grizzly thread pool API.
>> The only solution I see, is to release next Grizzly 1.8.6.x, where we
>> can integrate latest Comet related modules. Jeanfrancois is traveling
>> to Europe now, may be Shing Wai, do you know if it's possible to
>> integrate latest Comet changes to Grizzly 1.8.6.x branch?
>>
>> Thanks.
>>
>> WBR,
>> Alexey.
>>
>>>
>>>
>>> Thanks
>>> Michal
>>>
>>> Oleksiy Stashok pisze:
>>>> Hi Michal,
>>>>
>>>> you said you updated grizzly-optionals.jar, but unfortunately it's
>>>> not enough. You've to update also grizzly-module.jar, where Grizzly
>>>> core is located.
>>>>
>>>> Thanks.
>>>>
>>>> WBR,
>>>> Alexey.
>>>>
>>>> On Dec 4, 2008, at 14:50 , Michał Orzechowski wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> Thanks, for advice. I'm using Grizzly 1.8.6.2 (default in
>>>>> Glassfish v3-predule), where this attribute isn't avaible. I have
>>>>> tried to update Glassfish glassfish-optionals.jar with new version
>>>>> 1.9.0 of comet, cometd and messages jars using hints from your
>>>>> blog. However now I get an exception when application starts:
>>>>>
>>>>> SEVERE:
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.getThreadPool()Ljava/util/concurrent/ExecutorService;
>>>>>
>>>>> java.lang.NoSuchMethodError:
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.getThreadPool()Ljava/util/concurrent/ExecutorService;
>>>>>
>>>>> at
>>>>> com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:307)
>>>>> at
>>>>> com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:84)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:130)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:109)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
>>>>>
>>>>> at com.sun.grizzly.http.TaskBase.call(TaskBase.java:359)
>>>>> at
>>>>> com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
>>>>> SEVERE: WorkerThreadImpl unexpected exception:
>>>>> java.lang.RuntimeException: java.lang.NoSuchMethodError:
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.getThreadPool()Ljava/util/concurrent/ExecutorService;
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:106)
>>>>>
>>>>> at com.sun.grizzly.http.TaskBase.call(TaskBase.java:359)
>>>>> at
>>>>> com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
>>>>> Caused by: java.lang.NoSuchMethodError:
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.getThreadPool()Ljava/util/concurrent/ExecutorService;
>>>>>
>>>>> at
>>>>> com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:307)
>>>>> at
>>>>> com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:84)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:130)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:109)
>>>>>
>>>>> at
>>>>> com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:88)
>>>>>
>>>>> ... 3 more
>>>>>
>>>>> I'm stuck. Is there any way to update girizzly to verson 1.9.0 in
>>>>> Glassfish? If you could help me, I would be very gratefull.
>>>>>
>>>>> Thanks
>>>>> Michal
>>>>>
>>>>>
>>>>>
>>>>> Jeanfrancois Arcand pisze:
>>>>>> Salut,
>>>>>>
>>>>>> Michał Orzechowski wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm trying to develop simple app that:
>>>>>>> 1. Allows clients to subscribe to a channel. The index.html
>>>>>>> page is a client's page where new data should be published.
>>>>>>> Client logic is implemented using Dojo Toolkit v 1.1.1
>>>>>>> (standard subscribe method)
>>>>>>>
>>>>>>> 2. Publish new data using the servlet. The post.html is a admin
>>>>>>> page from witch I send data to the servlet.
>>>>>>> Servlet's logic is implemented with Grizzly Comet/Bayeux
>>>>>>> (default GlassFish V3 components ...)
>>>>>>>
>>>>>>> Here is what i do:
>>>>>>>
>>>>>>> 1. Open client page in browser A
>>>>>>> 2. Open client page in browser B (tab 1)
>>>>>>> 3. Open admin page in browser B (tab 2)
>>>>>>> 4. Send data from admin page to servlet ...
>>>>>>> .. and nothing happens .. clients aren't notified until i
>>>>>>> open new client page in browser B in tab 3 (or browser A in tab
>>>>>>> 2 - no matter)!
>>>>>>>
>>>>>>> It looks like server is holding the data and i really don't
>>>>>>> know why. Its really strange and i hope maybe some would be
>>>>>>> able to help me?
>>>>>>>
>>>>>>> Servlet code :
>>>>>>>
>>>>>>> public class DataServlet extends HttpServlet {
>>>>>>>
>>>>>>> CometContext context;
>>>>>>>
>>>>>>> @Override
>>>>>>> public void init(ServletConfig config) throws ServletException {
>>>>>>> super.init(config);
>>>>>>> String contextPath = "/CometApp/cometd";
>>>>>>> CometEngine cometEngine = CometEngine.getEngine();
>>>>>>> context = cometEngine.register(contextPath);
>>>>>>> context.setExpirationDelay(60 * 1000);
>>>>>>> }
>>>>>>>
>>>>>>> protected void processRequest(HttpServletRequest request,
>>>>>>> HttpServletResponse response)
>>>>>>> throws ServletException, IOException {
>>>>>>> String channel = "/my/demo";
>>>>>>> String messageDataName = "text";
>>>>>>> String messageDataValue = request.getParameter("newinfo");
>>>>>>>
>>>>>>> if (messageDataValue != null) {
>>>>>>> Map<String, Object> map = new HashMap<String, Object>();
>>>>>>> map.put(messageDataName,
>>>>>>> dummyBussinesLogic(messageDataValue));
>>>>>>> Data data = new Data();
>>>>>>> data.setMapData(map);
>>>>>>>
>>>>>>> DeliverResponse deliverResponse = new DeliverResponse();
>>>>>>> deliverResponse.setChannel(channel);
>>>>>>> deliverResponse.setData(data);
>>>>>>> deliverResponse.setLast(true);
>>>>>>> deliverResponse.setFollow(true);
>>>>>>
>>>>>> Just add:
>>>>>>
>>>>>> deliverResponse.setFinished(true);
>>>>>>
>>>>>> and I suspect it will works.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> -- Jeanfrancois
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> context.notify(deliverResponse);
>>>>>>>
>>>>>>> out.println("Data is sent.");
>>>>>>> } else {
>>>>>>> out.println("No data is sent.");
>>>>>>> }
>>>>>>>
>>>>>>> response.sendRedirect("post.html");
>>>>>>> }
>>>>>>>
>>>>>>> @Override
>>>>>>> protected void doGet(HttpServletRequest request,
>>>>>>> HttpServletResponse response)
>>>>>>> throws ServletException, IOException {
>>>>>>> processRequest(request, response);
>>>>>>> }
>>>>>>>
>>>>>>> @Override
>>>>>>> protected void doPost(HttpServletRequest request,
>>>>>>> HttpServletResponse response)
>>>>>>> throws ServletException, IOException {
>>>>>>> processRequest(request, response);
>>>>>>> }
>>>>>>>
>>>>>>> private String dummyBussinesLogic(String s) {
>>>>>>> return s.toUpperCase();
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> Thanks
>>>>>>> Michal Orzechowski
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>>> <mailto:users-help_at_grizzly.dev.java.net>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>>> <mailto:users-help_at_grizzly.dev.java.net>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>>> <mailto:users-help_at_grizzly.dev.java.net>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>> <mailto:users-help_at_grizzly.dev.java.net>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> <mailto:users-unsubscribe_at_grizzly.dev.java.net>
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>> <mailto: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
>