java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z

2,498 views
Skip to first unread message

Jason Bodnar

unread,
Jun 14, 2017, 2:15:32 PM6/14/17
to wiremock-user
I'm using WireMock 2.6.0:

testCompile "com.github.tomakehurst:wiremock-standalone:2.6.0"

PUT and POST work just fine but when I try a GET I get the following exception:

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.isAsyncStarted()Z

I've read that there may be a conflict between servlet-api versions bug gradle dependencies shows no listing for servlet-api at all. I also tried the non-standalone version of WireMock and I got the same error.

Here's the request:

2017-06-14 13:14:01.060 Received request to /mappings with body {
  "id" : "5e7eac71-6166-4bc9-9cf7-dd0cc33413d3",
  "request" : {
    "urlPathPattern" : "/service/validate_for_release",
    "method" : "GET",
    "queryParameters" : {
      "name" : {
        "equalTo" : "pact-gradle-plugin-test"
      },
      "version" : {
        "equalTo" : "1.2345"
      }
    }
  },
  "response" : {
    "status" : 200
  },
  "uuid" : "5e7eac71-6166-4bc9-9cf7-dd0cc33413d3"
}

and here's how I have WireMock stubbed:

String path = "/service/validate_for_release"
stubFor(get(urlPathMatching(path))
.withQueryParam("name", equalTo(artifactId))
.withQueryParam("version", equalTo(version))
.willReturn(aResponse().withStatus(200))
)


Thanks,

Jason




Tom Akehurst

unread,
Jun 14, 2017, 2:55:39 PM6/14/17
to wiremock-user
Can you post a full dump of your Gradle dependencies? I can't imagine how this could happen unless you've got a conflicting servlet api in there.

Bear in mind some libraries e.g. jetty bake the servlet api in.

Jason Bodnar

unread,
Jun 14, 2017, 2:57:48 PM6/14/17
to wiremock-user
Attached.
dependencies

Tom Akehurst

unread,
Jun 14, 2017, 3:12:03 PM6/14/17
to wiremock-user
I can't see any of the usual suspects in there, but here's a trick I use to see where a particular class is coming from:

public class TmpTest {

@Test
public void whereClass() {
System.out.println(HttpServletRequest.class.getProtectionDomain().getCodeSource().toString());
}
}

Bodnar, Jason

unread,
Jun 14, 2017, 3:20:07 PM6/14/17
to Tom Akehurst, wiremock-user
​(file:/home/jbodnar/.gradle/caches/2.14.1/generated-gradle-jars/gradle-api-2.14.1.jar <no signer certificates>)

Seems to be the culprit. I guess I'll see if there's a newer version.​


On Wed, Jun 14, 2017 at 2:12 PM, 'Tom Akehurst' via wiremock-user <wiremo...@googlegroups.com> wrote:
 System.out.println(HttpServletRequest.class.getProtectionDomain().getCodeSource().toString());




--
Reply all
Reply to author
Forward
0 new messages