Exception in matchingJsonPath with wiremock

2k views Asked by At

I'm trying to stub interaction (groovy code)

stubInteraction(
        post(urlEqualTo("/someUrl"))
                .withRequestBody(matchingJsonPath("\$.firstName"))
            aResponse()
                .withBody("")
                .withStatus(200)

I receive exception

Problem accessing /someUrl. Reason:
com.jayway.jsonpath.JsonPath.read(Ljava/lang/String;Ljava/lang/String;[Lcom/jayway/jsonpath/Filter;)Ljava/lang/Object;</pre></p><h3>Caused by:</h3><pre>java.lang.NoSuchMethodError: com.jayway.jsonpath.JsonPath.read(Ljava/lang/String;Ljava/lang/String;[Lcom/jayway/jsonpath/Filter;)Ljava/lang/Object;
at com.github.tomakehurst.wiremock.matching.ValuePattern.isJsonPathMatch(ValuePattern.java:194)

For json:

{"firstName":"Jan"}

What i am doing wrong?

1

There are 1 answers

1
Tom On BEST ANSWER

Looks like a dependency problem. Do you have jsonpath included via some other dependency?

If this is the case you might want to try including the standalone version with all dependencies excluded as described here: http://wiremock.org/getting-started.html