Problem with cometd and jetty 6 / 7

Posted by Ceilingfish on Stack Overflow See other posts from Stack Overflow or by Ceilingfish
Published on 2010-05-26T15:09:54Z Indexed on 2010/05/26 15:11 UTC
Read the original article Hit count: 1121

Filed under:
|

Hi chaps, I'm trying to get started with cometd (http://cometd.org/) 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:

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)

Seemed to go through all the jetty binaries and complain about each class file.

When I tried to deploy to 6.1.24 I got

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)

My web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<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">

    <servlet>
        <servlet-name>cometd</servlet-name>
        <servlet-class>org.cometd.server.continuation.ContinuationCometdServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>cometd</servlet-name>
        <url-pattern>/cometd/*</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>initializer</servlet-name>
        <servlet-class>uk.co.dubit.nexus.comet.BayeuxInitializer</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <!-- <filter>
        <filter-name>cross-origin</filter-name>
        <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>cross-origin</filter-name>
        <url-pattern>/cometd/*</url-pattern>
    </filter-mapping> -->

</web-app>

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?).

Sorry for the noob question but does anyone know what I'm doing wrong here?

Regards, Tom

© Stack Overflow or respective owner

Related posts about jetty

Related posts about cometd