ClassNotFoundException at startup - Atmosphere/atmosphere Wiki

If you deploy your application in a WebServer and get a ClassNotFoundException like

[Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.WebSocketFactory$Acceptor
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
    at org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket.service(Servlet30AsyncSupportWithWebSocket.java:59)
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1124)
    at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:293)
    at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:279)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source) 

it means the Atmosphere Framework detected the wrong WebServer on which it is running. This usually happens because you have wrong dependencies bundled with your application. As an example, if your application contains, under WEB-INF/lib, jetty-server.jar and you deploy your war in Tomcat, the above exception might be thrown. The solution is to remove the Jetty related jars and redeploy. If you really need those classes, you can force Atmosphere to a specific WebServer by adding the following in your web/application.xml:

        <init-param>
            <param-name>org.atmosphere.cpr.asyncSupport</param-name>
            <param-value>..VALUE...</param-value>
        </init-param>

The ..VALUE... can be one of the default Atmosphere's implementation