Atmosphere servlet on jetty8, java.lang.ClassNotFoundException: org.atmosphere.cpr.DefaultBroadcaster

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Atmosphere servlet on jetty8, java.lang.ClassNotFoundException: org.atmosphere.cpr.DefaultBroadcaster

bigklubba
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I have created a bundle that I want to use on a current jetty8 server implementation. The servlet is created by an activator in the bundle and is later added to the server in a ServletHolder. As my servlet is in a bundle and is loaded by the osgi framework I don't have a atmosphere.xml file (not sure where this should be located in the bundle) instead I add the parameters by code:
        this.framework().addAtmosphereHandler("/socketio", new SocketIOServletAtmosphereHandler());
        this.framework().addInitParameter("socketio-transport", "websocket,xhr-polling,jsonp-polling");
        this.framework().addInitParameter("socketio-timeout", "250000");
        this.framework().addInitParameter("socketio-heartbeat", "150000");
        this.framework().addInitParameter("socketio-suspendTime", "300000");
Now to the problem: When I start the servlet I get the following error:
2012-08-07 11:29:21.323 ERROR [AtmosphereFramework] Unable to configure Broadcaster/Factory/Cache
java.lang.ClassNotFoundException: org.atmosphere.cpr.DefaultBroadcaster
     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
     at org.atmosphere.cpr.AtmosphereFramework.configureBroadcaster(AtmosphereFramework.java:590)
     at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:486)
     at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:191)
     at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:456)
     at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:276)
     at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
     at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:779)
     at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:255)
     at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:610)
     at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
     at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
     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:262)
     at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)

The code that generates this error is:
if (broadcasterFactory == null) {
                Class<? extends Broadcaster> bc =
                        (Class<? extends Broadcaster>) Thread.currentThread().getContextClassLoader()
                                .loadClass(broadcasterClassName);
                broadcasterFactory = new DefaultBroadcasterFactory(bc, broadcasterLifeCyclePolicy, config);
            }
When I debug the code I can see that the contextclassloader is not null and broadcasterClassName = org.atmosphere.cpr.DefaultBroadcaster but when the class is loaded the program throws the exception.

I'm running
Atmosphere 1.0.0beta3