Jetty throws NoClassDefFoundError: org/eclipse/jetty/util/FutureCallback on shutdown

半世苍凉 提交于 2019-12-05 00:26:05

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.

Jan

I fixed that in 9.2.3. See the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=438500

I received this error because the directory "target/classes" didn't exist. A quick way to solve this is to simply create a src/main/java folder, and then create any class (even an empty class) there.

I had similar problem using eclipse Jetty plugin. Resolved it by adding proper dependencies. For more details visit - http://eclipse-jetty.github.io/faq.html

i faced the same issue and i was using jetty version 9.4.12.v20180830 after that i change the version to version 9.4.12.RC2 and everything worked fine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!