MariuszS
MariuszS

Reputation: 31587

Exception in matchingJsonPath with wiremock

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?

Upvotes: 0

Views: 2106

Answers (1)

Tom
Tom

Reputation: 4149

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

Upvotes: 1

Related Questions