White Paper + Example EAR + Example Code

33 views
Skip to first unread message

Jeff Porter

unread,
Feb 21, 2007, 9:31:11 AM2/21/07
to cometd-users

Hello all,

Sorry for the delay in posting the PDF + code.

It seems I'd been working too many hours and my first version has some
mistakes in it.
Thanks to Sajit D for pointing them out.

Anyway the paper and code are now online.

http://www.qenet.co.uk/warwick/whitepaper-pushTech.pdf
http://www.qenet.co.uk/warwick/dashsample.ear
http://www.qenet.co.uk/warwick/dashsampleSource.zip

Again this is my first white paper, so be gentle ;-)
Please feel free to make suggestions or comments. I'll change it as
required.

Finally Llia & David, sorry about the 404 :-)

Jeff Porter

Alex Russell

unread,
Feb 23, 2007, 4:47:08 PM2/23/07
to cometd...@googlegroups.com, Jeff Porter
My only comment is that "Comet" is designed to be a term that describes
the general approach taken by Pushlets, Cometd, KnowNow, mod_pubsub,
etc. The idea is that while XHR might be the technology behind Ajax,
the term Ajax describes the general interaction+tech combination. The
term "Comet" is designed to do the same thing for web-based push. The
implementations may have other names, but the term "push" carries some
baggage related to the last boom that I'm sure you might not want to
invoke.

Regards

> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "cometd-users" group. To post to this group, send email to
> cometd...@googlegroups.com To unsubscribe from this group, send
> email to cometd-users...@googlegroups.com For more options,
> visit this group at http://groups.google.com/group/cometd-users
>
> Visit the cometd website at http://www.cometd.com/
> -~----------~----~----~----~------~----~------~--~---

--
Alex Russell
al...@sitepen.com A99F 8785 F491 D5FD 04D7 ACD9 4158 FFDF 2894 6876
al...@dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723

Jeff Porter

unread,
Feb 27, 2007, 11:56:45 AM2/27/07
to cometd-users

I've had an email from from Engin about some issue his having with
JBoss 4.0.5 and my example code.

He is my responce:

------------------------------------------------------
Hi Engin,

I've only tested my example with Jboss-4.0.3SP1 and deploying the EAR
file.
Not Jboss4.0.5 and just the WAR (which wont work since files will be
missing)

Under JBoss 4.0.5GA I get the same error as you.

I'm not a big fan of JBoss 4.0.5 mostly since I've not had the time to
sit down and work out what's going on with the class loading in that
version.
Anyway...

Jboss 4.0.5 contains HTTPClient version 2.0
I'm using version 3.0
Version 2.0 is loaded higher up the class loader chain, so hence the
class HTTPClient is the wrong one for my code.

Fix:
Using: jboss-4.0.5.GA.zip
Unzip and delete these files:...

C:\jboss-4.0.5.GA\client\commons-httpclient.jar
C:\jboss-4.0.5.GA\lib\commons-httpclient.jar
C:\jboss-4.0.5.GA\server\all\lib\commons-httpclient.jar
C:\jboss-4.0.5.GA\server\default\lib\commons-httpclient.jar

Change this file:
C:\jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar
\server.xml

From:
<Connector port="8080" address="${jboss.bind.address}"

To:
<Connector port="80" address="${jboss.bind.address}"

Start Jboss and the demo should work.

Jeff Porter


------------------------------------------------------

Engin...

===
In JBoss 4.0.5
===
Deployed your dashsample.ear to server\default\deploy

I get the following error:

16:09:30,106 ERROR [LogInterceptor] Unexpected Error in method: public
abstract
void javax.ejb.TimedObject.ejbTimeout(javax.ejb.Timer)
java.lang.NoSuchMethodError:
org.apache.commons.httpclient.HttpClient.getParams(
)Lorg/apache/commons/httpclient/params/HttpClientParams;
at com.kbtflawt.server.ejb.Publisher.setup(Publisher.java:73)
at com.kbtflawt.server.ejb.Publisher.<init>(Publisher.java:20)
at
com.kbtflawt.server.ejb.Publisher.getInstance(Publisher.java:28)
at
com.kbtflawt.server.ejb.DirectoryPoller.run(DirectoryPoller.java:87)
at
com.kbtflawt.server.ejb.DirectoryPoller.ejbTimeout(DirectoryPoller.ja
va:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


Jeff Porter

unread,
Feb 28, 2007, 7:05:06 AM2/28/07
to cometd-users

Another question from Engin, I'm putting the question/responce in here
so that all the knowledge it kept in one place.
-----------------------------------
Hi Engin,

What do you mean the "Publisher" doesn't work? Is there an error
message?
You don't need to do anything to start the Publisher, its runs on its
own.
The path of events is ...

DirectoryPoller is a EJB that wakes up every X seconds.
DirectoryPoller makes a call to the Publisher class.
Publisher makes HTTP call to the servlet via HTTPClient code.
StillagePublisher servlet uses the servlet context to get a reference
to the Bayeux instance from the JettyServlet engine.
A map of values is then published to the Channel from the Bayeux
class.

--------------------
I don't know how you'd make it work only in a WAR, the sections of
knowledge that I'm missing at the moment are...

1:
The Jetty servlet supports Continuations, which Tomcat does not (it
might do now, but not at the time of my report).
So you need to use the Jetty servlet engine.

2:
Since the Jetty servlet contains Continuations, you can get the Bayeux
from the servlet context.
It's this Bayeux reference you need to send messages out to listening
pages.

3:
The final part of knowledge I'm missing is making cometD request from
outside a servlet. This is the reason my code makes a call to a
Publisher class, which uses HTTPClient to poke the servlet into life,
making it send the data out.

Jeff


________________________________________
From: Engin Bozdag [mailto:v.e.bozdag@sxxxxxx]
Sent: 27 February 2007 22:33
To: Jeffrey Porter
Subject: Re: need help with comet

Hey Jeff,

Thanks for the quick reply!

I followed your instructions for 4.0.5GA and also tried dashsample
under 4.0.3SP1. Now I don't get errors anymore and I see Bayeux
messages on the console. The push system works if I manually point my
browser to /stillagePublisher, LOOPS messages are succesfully sent and
the bars are updated. However Publisher class doesn't seem to work,
do I need to do something special to activate it, so that it makes
those requests to stillagePublisher automatically ?

How can we make this setup work in Tomcat with a WAR file only? I am
not so familiar with Jboss, been working with servlets and Tomcat
lately. Apologies for this (silly) question.

thanks again!

Engin


Engin Bozdag

unread,
Feb 28, 2007, 7:49:46 AM2/28/07
to cometd-users
> What do you mean the "Publisher" doesn't work? Is there an error
> message?

With Jboss-4.0.3 SP1 Under Windows, I am getting the following error
(periodically):

13:35:37,440 INFO [STDOUT] java.net.ConnectException: Connection
refused: conne
ct
...
13:35:37,440 INFO [STDOUT] at java.net.Socket.connect(Socket.java:
516)
...
13:35:37,440 INFO [STDOUT] at
org.apache.commons.httpclient.HttpConnection.
open(HttpConnection.java:706)
13:35:37,456 INFO [STDOUT] at
org.apache.commons.httpclient.HttpMethodDirec
tor.executeWithRetry(HttpMethodDirector.java:386)
13:35:37,456 INFO [STDOUT] at
org.apache.commons.httpclient.HttpMethodDirec
tor.executeMethod(HttpMethodDirector.java:170)
13:35:37,456 INFO [STDOUT] at
org.apache.commons.httpclient.HttpClient.exec
uteMethod(HttpClient.java:396)
13:35:37,456 INFO [STDOUT] at
org.apache.commons.httpclient.HttpClient.exec
uteMethod(HttpClient.java:324)
13:36:51,268 INFO [STDOUT] at
org.apache.commons.httpclient.HttpClient.exec
uteMethod(HttpClient.java:324)
13:36:51,268 INFO [STDOUT] at
com.kbtflawt.server.ejb.Publisher.publishAler
ts(Publisher.java:53)
13:36:51,268 INFO [STDOUT] at
com.kbtflawt.server.ejb.DirectoryPoller.run(D
irectoryPoller.java:87)
13:36:51,268 INFO [STDOUT] at
com.kbtflawt.server.ejb.DirectoryPoller.ejbTi
meout(DirectoryPoller.java:69)

So HTTPClient can not be initiated by Publisher properly. Publisher is
not making a call to StillagePublisher via HTTPClient. To see the
effect of the push, I have to call StillagePublisher manually,
myself.


> The Jetty servlet supports Continuations, which Tomcat does not (it
> might do now, but not at the time of my report).
> So you need to use the Jetty servlet engine.

I think I was a bit unclear on this. Of course Tomcat (at least 5.5)
will not work with Continuations itself. I want the application (WAR
file) work under Tomcat (not Tomcat under Jboss), with Jetty
libraries. You still have to make use use of Bayeux class, its
handlers and Dojo toolkit of course. But If i drop your WAR file
(which I extracted from EAR) and edit the web.xml part accordingly, it
is not working under standalone Tomcat, even if I try to invoke
StillagePublisher servlet myself.


Engin Bozdag

unread,
Feb 28, 2007, 8:02:31 AM2/28/07
to cometd-users
Nevermind my previous post about Tomcat and StillagePublisher. It
works fine if I drop the WAR file to Tomcat and remove EJB parts and
StartupServlet. However Publisher and HTTPClient still is not working
under Jboss.

Jeff Porter

unread,
Feb 28, 2007, 8:07:14 AM2/28/07
to cometd...@googlegroups.com
what do you mean not working under jboss?

Jeff Porter

unread,
Feb 28, 2007, 10:34:20 AM2/28/07
to cometd...@googlegroups.com
I was missing an email the the thread.

I suspect the Publisher can not connect since it connecting to the wrong port.
is the servlet runing on port 80?

:-)

Jeff Porter

Engin Bozdag

unread,
Mar 2, 2007, 5:31:46 AM3/2/07
to cometd...@googlegroups.com
Yes, that does the trick. I had already apache running on that port (80), and I thought you wanted me to change the port for some other reason.

By the way, I also used JMeter to simulate an HTTP request every 2 seconds, instead of HTTPClient. It is just an option, if HTTPClient is giving problems.

Thanks Jeff!

Engin


On 2/28/07, Jeff Porter <je...@porter.eu.com> wrote:
I was missing an email the the thread.

I suspect the Publisher can not connect since it connecting to the wrong port.
is the servlet runing on port 80?

:-)

Jeff Porter

On 2/28/07, Jeff Porter <je...@porter.eu.com> wrote:
what do you mean not working under jboss?




On 2/28/07, Engin Bozdag < boz...@gmail.com> wrote:

Nevermind my previous post about Tomcat and StillagePublisher. It
works fine if I drop the WAR file to Tomcat and remove EJB parts and
StartupServlet. However Publisher and HTTPClient still is not working
under Jboss.












--
Engin
Reply all
Reply to author
Forward
0 new messages