wiremock is not working with jetty 9.4.29.v20200521

Created on 24 May 2020  路  5Comments  路  Source: tomakehurst/wiremock

I'm using com.github.tomakehurst:wiremock-jre8:2.26.3

and the commit that I believe is the culprit
https://github.com/eclipse/jetty.project/commit/46ad90598c65d127124395db32172f381579a825#r39400262

java.lang.NoSuchMethodError: 'java.nio.channels.ByteChannel org.eclipse.jetty.io.ChannelEndPoint.getChannel()'
    at com.github.tomakehurst.wiremock.jetty9.JettyFaultInjector.socket(JettyFaultInjector.java:92)
    at com.github.tomakehurst.wiremock.jetty9.JettyFaultInjector.<init>(JettyFaultInjector.java:44)
    at com.github.tomakehurst.wiremock.jetty9.JettyFaultInjectorFactory.buildFaultInjector(JettyFaultInjectorFactory.java:49)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.buildFaultInjector(WireMockHandlerDispatchingServlet.java:228)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.applyResponse(WireMockHandlerDispatchingServlet.java:198)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet$ServletHttpResponder.respondTo(WireMockHandlerDispatchingServlet.java:183)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet$ServletHttpResponder.respondSync(WireMockHandlerDispatchingServlet.java:150)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet$ServletHttpResponder.respond(WireMockHandlerDispatchingServlet.java:144)
    at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:90)
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.service(WireMockHandlerDispatchingServlet.java:120)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)

Most helpful comment

I've upgraded one of our projects to Spring Boot 2.3.1 and a couple of tests got broke. Because with this version of Spring Boot, they have upgraded Jetty to 9.4.29.v20200521.

All 5 comments

There will be a Jetty upgrade in the next release.

In the meantime try the standalone version, as this shades Jetty.

I've upgraded one of our projects to Spring Boot 2.3.1 and a couple of tests got broke. Because with this version of Spring Boot, they have upgraded Jetty to 9.4.29.v20200521.

There will be a Jetty upgrade in the next release.

In the meantime try the standalone version, as this shades Jetty.

How can I use standalone in my unit tests? (I using wiremock to mock my services endpoint)

How can I use standalone in my unit tests? (I using wiremock to mock my services endpoint)

<dependency>
  <groupId>com.github.tomakehurst</groupId>
  <artifactId>wiremock-jre8-standalone</artifactId>
  <version>2.27.1</version>
  <scope>test</scope>
</dependency>

Fixed in 64294f0a2a39c3eb308734d5bb73b6c6e16dc49a

Was this page helpful?
5 / 5 - 1 ratings