title: Problem with cometd and jetty 6 / 7
body: <p>I'm trying to get started with cometd (<a href="http://cometd.org/" rel="nofollow noreferrer">http://cometd.org/</a>) and jetty 6 or 7, but I seem to be having problems. I've got an ant script that packages my code up into a war with the cometd 1.1.1 binaries and jetty binaries that are appropriate to the version of jetty I deploy the war to (so 7.1.2.v20100523 binaries when I deploy to jetty 7.1.2.v20100523 and 6.1.24 when I deploy to 6.1.24). I first tried getting a setup with version 7.1.2.v20100523, but when I tried to deploy I got a very long stack trace sample of which is:</p>
  
  <pre><code>2010-05-26 15:32:12.906:WARN::Problem processing jar entry org/eclipse/jetty/util/MultiPartOutputStream.class
  java.io.IOException: Invalid resource
      at org.eclipse.jetty.util.resource.URLResource.getInputStream(URLResource.java:204)
      at org.eclipse.jetty.util.resource.JarResource.getInputStream(JarResource.java:113)
      at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
      at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
      at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
      at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
      at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
      at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
      at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:68)
      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:992)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:579)
      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:381)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
      at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
      at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:497)
      at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
      at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:77)
      at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:490)
      at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:355)
      at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
      at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:258)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)
  2010-05-26 15:32:12.907:WARN::Problem processing jar entry org/eclipse/jetty/util/MultiPartWriter.class
  java.io.IOException: Invalid resource
      at org.eclipse.jetty.util.resource.URLResource.getInputStream(URLResource.java:204)
      at org.eclipse.jetty.util.resource.JarResource.getInputStream(JarResource.java:113)
      at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
      at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
      at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
      at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
      at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
      at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
      at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:68)
      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:992)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:579)
      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:381)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
      at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
      at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:497)
      at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
      at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:77)
      at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:490)
      at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:355)
      at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
      at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:258)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)
  2010-05-26 15:32:12.907:WARN::Problem processing jar entry org/eclipse/jetty/util/Attributes.class
  java.io.IOException: Invalid resource
      at org.eclipse.jetty.util.resource.URLResource.getInputStream(URLResource.java:204)
      at org.eclipse.jetty.util.resource.JarResource.getInputStream(JarResource.java:113)
      at org.eclipse.jetty.annotations.AnnotationParser$2.processEntry(AnnotationParser.java:575)
      at org.eclipse.jetty.webapp.JarScanner.matched(JarScanner.java:152)
      at org.eclipse.jetty.util.PatternMatcher.matchPatterns(PatternMatcher.java:82)
      at org.eclipse.jetty.util.PatternMatcher.match(PatternMatcher.java:64)
      at org.eclipse.jetty.webapp.JarScanner.scan(JarScanner.java:75)
      at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:587)
      at org.eclipse.jetty.annotations.AbstractConfiguration.parseWebInfLib(AbstractConfiguration.java:107)
      at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:68)
      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:992)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:579)
      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:381)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
      at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
      at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:182)
      at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:497)
      at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:135)
      at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileChanged(ScanningAppProvider.java:77)
      at org.eclipse.jetty.util.Scanner.reportChange(Scanner.java:490)
      at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:355)
      at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
      at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:258)
      at java.util.TimerThread.mainLoop(Timer.java:512)
      at java.util.TimerThread.run(Timer.java:462)
  </code></pre>
  
  <p>Seemed to go through all the jetty binaries and complain about each class file.</p>
  
  <p>When I tried to deploy to 6.1.24 I got</p>
  
  <pre><code>org.mortbay.util.MultiException[java.lang.NoClassDefFoundError: org/eclipse/jetty/util/ajax/JSON$Source, java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/ThreadPool]
      at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:656)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:224)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.mortbay.start.Main.invokeMain(Main.java:194)
      at org.mortbay.start.Main.start(Main.java:534)
      at org.mortbay.start.Main.start(Main.java:441)
      at org.mortbay.start.Main.main(Main.java:119)
  </code></pre>
  
  <p>My web.xml looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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_2_5.xsd"
           version="2.5"&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;cometd&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.cometd.server.continuation.ContinuationCometdServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&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;initializer&lt;/servlet-name&gt;
          &lt;servlet-class&gt;uk.co.dubit.nexus.comet.BayeuxInitializer&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;!-- &lt;filter&gt;
          &lt;filter-name&gt;cross-origin&lt;/filter-name&gt;
          &lt;filter-class&gt;org.eclipse.jetty.servlets.CrossOriginFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;cross-origin&lt;/filter-name&gt;
          &lt;url-pattern&gt;/cometd/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt; --&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>note cross origin filter is commented out. The class didn't seem to exist when I tried to run on 6.1.24 (which as far as I understand is the correct behaviour, yes?).</p>
  
  <p>Sorry for the noob question but does anyone know what I'm doing wrong here?</p>
  
  <p>Regards,
  Tom</p>