2

We have module that uses DropWizard with Jetty, and it fails on startup with the error: "org/eclipse/jetty/util/thread/ExecutionStrategy$Factory"

java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/ExecutionStrategy$Factory
    at org.eclipse.jetty.io.SelectorManager.<init>(SelectorManager.java:52)
    at org.eclipse.jetty.server.ServerConnector$ServerConnectorManager.<init>(ServerConnector.java:497)
    at org.eclipse.jetty.server.ServerConnector.newSelectorManager(ServerConnector.java:229)
    at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:221)
    at io.dropwizard.jetty.HttpConnectorFactory.buildConnector(HttpConnectorFactory.java:562)
    at io.dropwizard.jetty.HttpConnectorFactory.build(HttpConnectorFactory.java:539)
    at io.dropwizard.server.DefaultServerFactory.buildAppConnectors(DefaultServerFactory.java:234)
    at io.dropwizard.server.DefaultServerFactory.buildRoutingHandler(DefaultServerFactory.java:194)
    at io.dropwizard.server.DefaultServerFactory.build(DefaultServerFactory.java:172)
    at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:49)
    at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
    at io.dropwizard.cli.Cli.run(Cli.java:78)
    at io.dropwizard.Application.run(Application.java:93)

There are multiple modules in this project and there are 2 different jetty-io artifacts in the project, one with version: 9.3.20 and 9.4.18 (this is where SelectorManager is located, which tries to use the non-existing interface). And for some reason it seems like that the older version (9.3.20, which is pulled by another module) gets to be on the classpath, and it tries to use the Factory interface within the ExecutionStrategy interface. The ExecutionSrategy intervface is within the jetty-util artifact. And there are 2 versions of this artifact as well (9.4.18 and 9.3.19, the newer version does not have this Factory interface within ExecutionStrategy.

The result of mnv:dependency -Dverbose of the module where the error was thrown: result of mvn command

I dont really know how to tackle this issue, the maven tree looks good, the good dependencies are being used from what I am seeing

1

1 Answer 1

0

Do not mix multiple versions of Jetty at the same time.

It might be a good idea to depend on the jetty-bom to force all jetty dependencies to be a specific version, no matter the transitive dependencies where they are coming from. (directly referenced dependencies will not use bom features)

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-bom</artifactId>
        <version>9.4.28.v20200408</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.