0

我正在尝试存根交互(常规代码)

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

我收到异常

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)

对于 json:

{"firstName":"Jan"}

我做错了什么?

4

1 回答 1

1

看起来像一个依赖问题。您是否通过其他一些依赖项包含了 jsonpath?

如果是这种情况,您可能想尝试包括排除所有依赖项的独立版本,如下所述:http ://wiremock.org/getting-started.html

于 2014-11-24T22:11:04.293 回答