problems getting websocket 2.4.0 working with jetty 7.5.4

173 views
Skip to first unread message

Derek Cicerone

unread,
Feb 5, 2012, 5:51:09 PM2/5/12
to cometd-users
I've hit a few issues getting cometd 2.4.0 websocket support working
with jetty 7.5.4:

1. Configuration: the 2.4.0 instructions indicate that the web.xml
file should be modified to add a transports <init-param>. However,
the init-params are ignored if cometd is initialized from an
applicationContext.xml file via Spring (following instructions also in
the manual). We'll need some separate way to configure transports
when following the spring instructions.

2. After changing the configuration back to the standard web.xml setup
(since Spring doesn't seem to have a way to change the transports), I
get the following error:

Exception in thread "main" java.lang.NoSuchMethodError:
org.eclipse.jetty.websocket.WebSocketFactory.start()V
at
org.cometd.websocket.server.WebSocketTransport.init(WebSocketTransport.java:
92)
at org.cometd.server.BayeuxServerImpl.doStart(BayeuxServerImpl.java:
154)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
59)
at org.cometd.server.CometdServlet.init(CometdServlet.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at
org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
445)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:
265)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
59)
at
org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:
771)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:
249)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:
1213)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:
589)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
454)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
59)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:
89)
at org.eclipse.jetty.server.Server.doStart(Server.java:261)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
59)
at com.palantir.finance.web.WebServer.main(WebServer.java:39)

Could this be because I need a different version of Jetty? I'm using
7.5.4 - is v8 required?

Thanks!
Derek

Simone Bordet

unread,
Feb 5, 2012, 6:42:10 PM2/5/12
to cometd...@googlegroups.com
Hi,

On Sun, Feb 5, 2012 at 23:51, Derek Cicerone <derekc...@gmail.com> wrote:
> I've hit a few issues getting cometd 2.4.0 websocket support working
> with jetty 7.5.4:

CometD 2.4.0 requires Jetty 7.6.0.

> 1. Configuration: the 2.4.0 instructions indicate that the web.xml
> file should be modified to add a transports <init-param>.  However,
> the init-params are ignored if cometd is initialized from an
> applicationContext.xml file via Spring (following instructions also in
> the manual).  We'll need some separate way to configure transports
> when following the spring instructions.

It's enough to:

BayeuxServerImpl bayeuxServer = ...;
bayeuxServer.setTransports(new WebSocketTransport(bayeuxServer), ...);

Just translate that into Spring's XML.

Can you please raise a documentation task in JIRA about this, so we
improve the docs ?
http://bugs.cometd.org

Simon
--
http://cometd.org
http://intalio.com
http://bordet.blogspot.com
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Derek Cicerone

unread,
Feb 6, 2012, 11:51:58 PM2/6/12
to cometd-users
Good point - I should have noticed the requirement to use Jetty 7.6.0
in the announcement. I missed it because I only read the announcement
on the Dojo Toolkit blog (http://dojotoolkit.org/blog/1-7-tutorials-
cometd-2-4-0-wink-toolkit-1-4-1-and-documentation-feedback).
WebSocket is working great in the latest Firefox and Chrome.

Hmm, I'm not really a Spring guru - I'm not sure if it's possible to
set a property on a bean which uses the bean itself to construct the
property. I ended up just switching to the more standard web.xml
configuration and using a custom ServletContextAttributeListener to
create the Spring bean factory and hook everything up. I've created a
JIRA account - I'll file a documentation bug as soon as I get a
confirmation email.

Thanks for the quick help!

On Feb 5, 3:42 pm, Simone Bordet <sbor...@intalio.com> wrote:
> Hi,
>
> On Sun, Feb 5, 2012 at 23:51, Derek Cicerone <derekcicer...@gmail.com> wrote:
> > I've hit a few issues getting cometd 2.4.0 websocket support working
> > with jetty 7.5.4:
>
> CometD 2.4.0 requires Jetty 7.6.0.
>
> > 1. Configuration: the 2.4.0 instructions indicate that the web.xml
> > file should be modified to add a transports <init-param>.  However,
> > the init-params are ignored if cometd is initialized from an
> > applicationContext.xml file via Spring (following instructions also in
> > the manual).  We'll need some separate way to configure transports
> > when following the spring instructions.
>
> It's enough to:
>
> BayeuxServerImpl bayeuxServer = ...;
> bayeuxServer.setTransports(new WebSocketTransport(bayeuxServer), ...);
>
> Just translate that into Spring's XML.
>
> Can you please raise a documentation task in JIRA about this, so we
> improve the docs ?http://bugs.cometd.org
>
> Simon
> --http://cometd.orghttp://intalio.comhttp://bordet.blogspot.com
Reply all
Reply to author
Forward
0 new messages