title: Using cometD's Oort with tomcat
body: <p>We are using cometD with Tomcat 7.0.42 (which is a must). We now try to get Oort (the clustering mechanism of cometD) working. If I enabled Oort in the web.xml like this, each time another node tries to connect the exception below occures.</p>
  
  <p>I am well aware that cometD currently can't use Websockets with Tomcat which is why I would esxpect cometD to simply fall back to longpolling...</p>
  
  <p>This is my config:</p>
  
  
  
  <pre><code>  &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
       version="3.0"&gt;
  &lt;display-name&gt;messenger&lt;/display-name&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;cometd&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.cometd.server.CometdServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;allowedTransports&lt;/param-name&gt;
          &lt;param-value&gt;LongPollingTransport&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;timeout&lt;/param-name&gt;
          &lt;param-value&gt;20000&lt;/param-value&gt;
      &lt;/init-param&gt;
  
  
      &lt;init-param&gt;
          &lt;param-name&gt;jsonContext&lt;/param-name&gt;
          &lt;param-value&gt;org.cometd.server.JacksonJSONContextServer&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;maxInterval&lt;/param-name&gt;
          &lt;param-value&gt;10000&lt;/param-value&gt;
      &lt;/init-param&gt;
  
      &lt;init-param&gt;
          &lt;param-name&gt;long-polling.multiSessionInterval&lt;/param-name&gt;
          &lt;param-value&gt;2000&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;async-supported&gt;true&lt;/async-supported&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;cometd&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/cometd/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;Oort&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.cometd.oort.OortStaticConfigServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;oort.url&lt;/param-name&gt;
          &lt;param-value&gt;http://192.168.178.37:8080/messenger/cometd&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;oort.channels&lt;/param-name&gt;
          &lt;param-value&gt;/messenger/**,/internal/**&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;oort.cloud&lt;/param-name&gt;
          &lt;param-value&gt;http://192.168.178.22:8080/messenger/cometd&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;async-supported&gt;true&lt;/async-supported&gt;
  &lt;/servlet&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;Seti&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.cometd.oort.SetiServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;3&lt;/load-on-startup&gt;
      &lt;async-supported&gt;true&lt;/async-supported&gt;
  &lt;/servlet&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is the exception:</p>
  
  <pre><code>org.cometd.common.TransportException: {httpCode=400, websocketCode=1002}
  at org.cometd.websocket.client.WebSocketTransport.connect(WebSocketTransport.java:287) ~[cometd-websocket-jetty-2.7.0.jar:na]
  at org.cometd.websocket.client.WebSocketTransport.send(WebSocketTransport.java:194) ~[cometd-websocket-jetty-2.7.0.jar:na]
  at org.cometd.client.BayeuxClient$BayeuxClientState.send(BayeuxClient.java:1390) ~[cometd-java-client-2.7.0.jar:na]
  at org.cometd.client.BayeuxClient.sendHandshake(BayeuxClient.java:374) ~[cometd-java-client-2.7.0.jar:na]
  at org.cometd.client.BayeuxClient$HandshakingState.execute(BayeuxClient.java:1496) ~[cometd-java-client-2.7.0.jar:na]
  at org.cometd.client.BayeuxClient.updateBayeuxClientState(BayeuxClient.java:1062) ~[cometd-java-client-2.7.0.jar:na]
  at org.cometd.client.BayeuxClient.handshake(BayeuxClient.java:315) ~[cometd-java-client-2.7.0.jar:na]
  at org.cometd.oort.Oort.connectComet(Oort.java:411) ~[cometd-java-oort-2.7.0.jar:na]
  at org.cometd.oort.Oort.observeComet(Oort.java:358) ~[cometd-java-oort-2.7.0.jar:na]
  at org.cometd.oort.Oort.observeComet(Oort.java:306) ~[cometd-java-oort-2.7.0.jar:na]
  at org.cometd.oort.OortMulticastConfigurer.receive(OortMulticastConfigurer.java:125) ~[cometd-java-oort-2.7.0.jar:na]
  at org.cometd.oort.OortMulticastConfigurer$MulticastReceiver.run(OortMulticastConfigurer.java:154) ~[cometd-java-oort-2.7.0.jar:na]
  at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
  
  Caused by: java.net.ProtocolException: Bad response status 400 Bad Request
  at org.eclipse.jetty.websocket.WebSocketClientFactory$HandshakeConnection.onClose(WebSocketClientFactory.java:546) ~[jetty-websocket-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.websocket.WebSocketClientFactory$WebSocketClientSelector.endPointClosed(WebSocketClientFactory.java:326) ~[jetty-websocket-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.io.nio.SelectorManager$SelectSet.destroyEndPoint(SelectorManager.java:848) ~[jetty-io-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.io.nio.SelectChannelEndPoint.doUpdateKey(SelectChannelEndPoint.java:601) ~[jetty-io-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:463) ~[jetty-io-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.io.nio.SelectorManager$1.run(SelectorManager.java:285) ~[jetty-io-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) ~[jetty-util-8.1.5.v20120716.jar:8.1.5.v20120716]
  at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) ~[jetty-util-8.1.5.v20120716.jar:8.1.5.v20120716]
  ... 1 common frames omitted
  </code></pre>