Our maven build throws at the end of the build of the shutdown of jetty a NoClassDefFoundError that I do not understand. Does anyone have an idea where this is comming from and how to fix it?
Here is are the dependencies from the pom file:
<dependencies>
<dependency>
<groupId>com.restfuse</groupId>
<artifactId>com.eclipsesource.restfuse</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.pe-international</groupId>
<artifactId>bom.model</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.3.4</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>json-path</artifactId>
<version>2.3.4</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>xml-path</artifactId>
<version>2.3.4</version>
</dependency>
</dependencies>
Jetty conf:
<!-- Start Jetty -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.2.v20140723</version>
<configuration>
<war>${basedir}/target/bla.war</war>
<httpConnector>
<port>8088</port>
</httpConnector>
<webApp>
<contextPath>/bla</contextPath>
</webApp>
<systemProperties>
<systemProperty>
<name>config.dir</name>
<value>${basedir}/target/config.dir</value>
</systemProperty>
</systemProperties>
<stopKey>fooStopBla</stopKey>
<stopPort>8089</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>process-test-resources</phase>
<goals>
<goal>deploy-war</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Here is mvn dependency:tree
[INFO] com.company:our.endpoint.test:jar:1.0.0-SNAPSHOT
[INFO] +- com.restfuse:com.eclipsesource.restfuse:jar:1.0.0:compile
[INFO] | +- org.mortbay.jetty:jetty-j2se6:jar:6.1.26:compile
[INFO] | | \- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] | | +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] | | \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
[INFO] | \- com.sun.jersey:jersey-bundle:jar:1.9.1:compile
[INFO] | \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.7:test
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.7:test
[INFO] +- org.easytesting:fest-assert:jar:1.4:test
[INFO] | \- org.easytesting:fest-util:jar:1.1.6:test
[INFO] +- com.company:our.model:jar:1.0.0-SNAPSHOT:test
[INFO] | +- org.jscience:jscience:jar:4.3.1:test
[INFO] | | \- org.javolution:javolution:jar:5.2.3:test
[INFO] | +- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.6.5:test
[INFO] | +- org.springframework:spring-beans:jar:4.1.1.RELEASE:test
[INFO] | | \- org.springframework:spring-core:jar:4.1.1.RELEASE:test
[INFO] | +- org.springframework:spring-context:jar:4.1.1.RELEASE:test
[INFO] | | +- org.springframework:spring-aop:jar:4.1.1.RELEASE:test
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:test
[INFO] | | \- org.springframework:spring-expression:jar:4.1.1.RELEASE:test
[INFO] | \- com.google.guava:guava:jar:15.0:test
[INFO] +- com.jayway.restassured:rest-assured:jar:2.3.4:compile
[INFO] | +- org.codehaus.groovy:groovy:jar:2.3.6:compile
[INFO] | +- org.codehaus.groovy:groovy-xml:jar:2.3.6:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.3.5:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | | \- commons-codec:commons-codec:jar:1.6:compile
[INFO] | +- org.apache.httpcomponents:httpmime:jar:4.3.5:compile
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] | \- org.ccil.cowan.tagsoup:tagsoup:jar:1.2.1:compile
[INFO] +- com.jayway.restassured:json-path:jar:2.3.4:compile
[INFO] | +- org.codehaus.groovy:groovy-json:jar:2.3.6:compile
[INFO] | \- com.jayway.restassured:rest-assured-common:jar:2.3.4:compile
[INFO] +- com.jayway.restassured:xml-path:jar:2.3.4:compile
[INFO] | \- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] \- org.mockito:mockito-all:jar:1.9.5:test
Here is our stacktrace:
2015-01-27 13:04:57.810:WARN:oejuc.AbstractLifeCycle:Thread-1: FAILED org.eclipse.jetty.maven.plugin.JettyServer@6dd82486: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/FutureCallback
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/FutureCallback
at org.eclipse.jetty.server.AbstractConnector.shutdown(AbstractConnector.java:284)
at org.eclipse.jetty.server.AbstractNetworkConnector.shutdown(AbstractNetworkConnector.java:108)
at org.eclipse.jetty.server.ServerConnector.shutdown(ServerConnector.java:298)
at org.eclipse.jetty.maven.plugin.MavenServerConnector.shutdown(MavenServerConnector.java:140)
at org.eclipse.jetty.server.Server.doStop(Server.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:132)
Caused by:
java.lang.ClassNotFoundException: org.eclipse.jetty.util.FutureCallback
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at org.eclipse.jetty.server.AbstractConnector.shutdown(AbstractConnector.java:284)
at org.eclipse.jetty.server.AbstractNetworkConnector.shutdown(AbstractNetworkConnector.java:108)
at org.eclipse.jetty.server.ServerConnector.shutdown(ServerConnector.java:298)
at org.eclipse.jetty.maven.plugin.MavenServerConnector.shutdown(MavenServerConnector.java:140)
at org.eclipse.jetty.server.Server.doStop(Server.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:132)
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/eclipse/jetty/util/FutureCallback
at org.eclipse.jetty.server.AbstractConnector.shutdown(AbstractConnector.java:284)
at org.eclipse.jetty.server.AbstractNetworkConnector.shutdown(AbstractNetworkConnector.java:108)
at org.eclipse.jetty.server.ServerConnector.shutdown(ServerConnector.java:298)
at org.eclipse.jetty.maven.plugin.MavenServerConnector.shutdown(MavenServerConnector.java:140)
at org.eclipse.jetty.server.Server.doStop(Server.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:132)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.FutureCallback
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 7 more
And sometimes the stacktrace varies and this comes up:
2015-01-28 10:12:55.630:WARN:oejuc.AbstractLifeCycle:ShutdownMonitor: FAILED org.eclipse.jetty.servlet.ServletHandler@3accac55: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/LazyList
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/LazyList
at org.eclipse.jetty.servlet.ServletHandler.doStop(ServletHandler.java:266)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.security.SecurityHandler.doStop(SecurityHandler.java:411)
at org.eclipse.jetty.security.ConstraintSecurityHandler.doStop(ConstraintSecurityHandler.java:457)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.server.session.SessionHandler.doStop(SessionHandler.java:127)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:835)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:215)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:529)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:388)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:143)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:162)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:73)
at org.eclipse.jetty.server.Server.doStop(Server.java:456)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.stopLifeCycles(ShutdownMonitor.java:273)
at org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.run(ShutdownMonitor.java:172)
Beware as some rest examples will make you add a maven dependency to jersey-container-jetty-http
, which includes a likely older version of jetty http. Remove that dependency if you already have a jetty-server
dep. in your pom file.
Looks like you have 2 versions of Jetty in your environment at the same time.
Your mvn dependency:tree
shows the following in your <scope>compile</scope>
dependencies.
[INFO] com.company:our.endpoint.test:jar:1.0.0-SNAPSHOT
[INFO] +- com.restfuse:com.eclipsesource.restfuse:jar:1.0.0:compile
[INFO] | +- org.mortbay.jetty:jetty-j2se6:jar:6.1.26:compile
[INFO] | | \- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] | | +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] | | \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
There are 2 concerns here.
First, is that restfuse
seems to be old, very old, and wants Jetty 6.1.26.
(This version of Jetty was EOL/End-of-Life back in 2007)
Second, is that this version could be affecting the behavior of your application when jetty-maven-plugin
is running.
Add an exclusion for Jetty 6, and it and give it a try.
<dependency>
<groupId>com.restfuse</groupId>
<artifactId>com.eclipsesource.restfuse</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-j2se6</artifactId>
</exclusion>
</exclusions>
</dependency>
But keep in mind that restfuse 1.0.0 might not work with Jetty 9. If so, you'll want to chase down a newer version of restfuse that has been updated for Jetty 9.
I fixed that in 9.2.3. See the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=438500
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With