users@grizzly.java.net

Re: cometd not performing properly

From: Joe Canon <jcanon.summit_at_gmail.com>
Date: Fri, 18 Nov 2011 13:22:46 -0800

Just to keep you informed, I was not able to get the same success from
vanilla cometd in glassfish. That is, the cometd samples still do not work
properly for me, even after changing the IPV4 setting and/or using jdk6. So
I am trying to get atmosphere/bateux working and running into issues.

I think the main issue is the availability of concise information. Is there
a tutorial or something available that is up to date for getting this
combination working? I added this to my pom.xml:
        <dependency>
            <groupId>com.sun.grizzly</groupId>
            <artifactId>grizzly-cometd</artifactId>
            <version>1.9.39</version>
        </dependency>
 <dependency>
     <groupId>org.atmosphere</groupId>
     <artifactId>atmosphere-jersey</artifactId>
     <version>0.8.0-RC3</version>
  </dependency>

And in web.xml, this:

    <servlet>
        <servlet-name>cometd</servlet-name>

<servlet-class>org.atmosphere.plugin.bayeux.AtmosphereBayeuxServlet</servlet-class>
        <init-param>
            <param-name>filters</param-name>
            <param-value>/WEB-INF/filters.json</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

At one time I had this:

    <servlet>
        <servlet-name>cometd</servlet-name>
        <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
        <init-param>
            <param-name>filters</param-name>
            <param-value>/WEB-INF/filters.json</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>


And this in Atmosphere.xml:

<atmosphere-handlers>
    <atmosphere-handler context-root="/cometd"
class-name="org.atmosphere.handler.ReflectorServletProcessor">
        <property name="servletClass"
value="org.atmosphere.plugin.bayeux.AtmosphereBayeuxServlet"/>
    </atmosphere-handler>
</atmosphere-handlers>

But I get exceptions whenever I deploy to Glassfish.

Have you any suggestions for me?

Thanks for your input,

Joe

On Tue, Nov 15, 2011 at 8:15 AM, Joe Canon <jcanon.summit_at_gmail.com> wrote:

> Yes, Alexey.
>
> Yes. I see the same dropped messages in the cometd chat demo (as I
> mentioned in my first message to this list).
>
> I haven't gotten back to testing that using jdk6 fixes that issue yet. But
> that is my plan. I am thinking that I will be better off with the cometd
> provided in glassfish than with Atmosphere because of all the extra jars I
> have to use for Atmosphere/Cometd. By just having grizzly-cometd in my pom
> I can run cometd in GF. Is this a reasonable course?
>
> I still have to test that jdk6 (or jdk7 with the JVM option for IPV4) will
> correct the issue with dropped messages there.
>
> Unfortunately the work I am doing here is for a side-contract I have. My
> 9-5 gig is encroaching at the moment - and I won't get back to testing the
> cometd stuff until tomorrow night.
>
> Best Regards, and thanks for your help,
>
> Joe
>
>
> On Tue, Nov 15, 2011 at 7:55 AM, Oleksiy Stashok <
> oleksiy.stashok_at_oracle.com> wrote:
>
>> Hi Joe,
>>
>>
>>
>> Not my app. Yours. I was having the issue with your demo for Atmosphere
>> Bayeux. It was the dojo-examples/chat/ application. That is the one that
>> would drop messages on my system under jdk7 but not jdk6. And not under
>> jdk7 with java.net.preferIPv4Stack=true. Although, as I mentioned, it seems
>> slow now.
>>
>> and you see the same problem with one of the Grizzly (w/o Atmosphere)
>> cometd samples, right?
>>
>> WBR,
>> Alexey.
>>
>>
>>
>> With jdk7 and not setting preferIOv4Stack, I would often see "system: Connection
>> to Server Broken" messages. I don't see them under jdk6 or with the IPv4
>> setting. But it is very slow.
>>
>> I am running everything on a Lenovo laptop with i5, 8G ram running
>> Windows 7, 64 bit. I am also using glassfish 3.1.2(b7), mysql cluster (ndb)
>> database, eclipse Indigo. Everything runs on localhost with no proxy
>> (except occasionally to look at traffic).
>>
>> HTH.
>>
>> WBR,
>>
>> Joe
>>
>> On Tue, Nov 15, 2011 at 12:34 AM, Oleksiy Stashok <
>> oleksiy.stashok_at_oracle.com> wrote:
>>
>>> Hi Joe,
>>>
>>> can you pls. share your app (may be simplified version), so I can
>>> reproduce the problem?
>>>
>>> Thank you.
>>>
>>> WBR,
>>> Alexey.
>>>
>>>
>>> On 11/15/2011 05:22 AM, Joe Canon wrote:
>>>
>>> I tried it using JDK7 with -Djava.net.preferIPv4Stack=true. This works!
>>> It is also slow. But it is working. Every message is sent and received.
>>>
>>> On Mon, Nov 14, 2011 at 8:04 PM, Joe Canon <jcanon.summit_at_gmail.com>wrote:
>>>
>>>> Hi Alexey,
>>>>
>>>> I tried the Atmosphere cometd demo today, as you suggested. The issue
>>>> was the same - that messages would not make it from one client to the other
>>>> in the chat.
>>>>
>>>> I was about to give up on it when I decided to try to run it under JDK
>>>> 6 instead of JDK 7. Going to JDK 1.6.0_29 seems to have resolved the issue.
>>>>
>>>> Now that I am using jdk6, there are no dropped messages. It is kind of
>>>> slow though. Sometimes 2 or 3 seconds before the message comes back from
>>>> the server. This will be a show stopper for us. So I have to get this
>>>> resolved or we can't use it. But I am happy to see some reliability.
>>>>
>>>> Does this make sense? Any idea what might be happening?
>>>>
>>>> Thanks and Regards,
>>>>
>>>> Joe
>>>>
>>>>
>>>> On Mon, Nov 14, 2011 at 12:15 AM, Oleksiy Stashok <
>>>> oleksiy.stashok_at_oracle.com> wrote:
>>>>
>>>>> Hi Joe,
>>>>>
>>>>> we'd suggest to use Atmosphere project for cometd support.
>>>>> Is it ok with you?
>>>>>
>>>>> WBR,
>>>>> Alexey.
>>>>>
>>>>>
>>>>>
>>>>> On 11/14/2011 01:43 AM, Joe Canon wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I am having issues using the cometd implementation in GlassFish. None
>>>>>> of the samples seem to work correctly for me. I've tried GF 3.1.1 and 3.1.2.
>>>>>>
>>>>>> For example, with the chat demo, I can join by enterring a username
>>>>>> and clicking join. Then I can chat. But the messages I send sometimes show
>>>>>> up at the client, and sometimes do not.
>>>>>>
>>>>>> Here's an example:
>>>>>>
>>>>>> client:
>>>>>> message=[{"data": {"user": "joe", "chat": "rgte"}, "channel":
>>>>>> "/chat/demo", "clientId": "pVJUfQl3gExtwMs+IAhAJQ==", "id": "15"}]
>>>>>> server:
>>>>>>
>>>>>> [{"channel":"/chat/demo","successful":true,"clientId":"pVJUfQl3gExtwMs+IAhAJQ==","id":"15"}]
>>>>>>
>>>>>> client:
>>>>>> message=[{"channel": "/meta/connect", "connectionType":
>>>>>> "long-polling", "clientId": "pVJUfQl3gExtwMs+IAhAJQ==", "timestamp": "Mon,
>>>>>> 14 Nov 2011 00:32:18 GMT", "id": "16"}]
>>>>>> server:
>>>>>> headers only 200 OK. No JSON message.
>>>>>>
>>>>>> But I don't see my message at the client (I expected to see "rgte").
>>>>>>
>>>>>> I am running a single client in a browser. I also have been running
>>>>>> the BayeuxExternalServlet. The messages that are sent from this servlet
>>>>>> almost never get to the browser client. One of maybe a hundred or so.
>>>>>>
>>>>>> Note that I have comet running. It seems to be performing properly.
>>>>>> But cometd is the problem.
>>>>>>
>>>>>> What could I be doing to cause this kind of behavior? I tried GF
>>>>>> 3.1.1 and 3.1.2 (build 7). Same behavior.
>>>>>>
>>>>>> Any suggestions would be greatly appreciated.
>>>>>>
>>>>>> Thank you,
>>>>>>
>>>>>> Joe
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>