https://linen.dev logo
#general
Title
# general
s

Shlomy Sheps

03/30/2023, 9:08 AM
hi has anyone can explain me how to overcome this issue: trying to call to
Copy code
wiremock.verifyThat(times, postRequestedFor(urlEqualTo(path)));
getting
Copy code
{
  "errors": [
    {
      "code": 10,
      "source": {
        "pointer": "/"
      },
      "title": "Error parsing JSON",
      "detail": "Cannot construct instance of `com.github.tomakehurst.wiremock.common.Errors` (although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (404)"
    }
  ]
}
r

Rob Elliot

03/30/2023, 9:17 AM
What version of WireMock are you using?
WireMock should be dumping a stacktrace somewhere... how are you running?
s

Shlomy Sheps

03/30/2023, 9:21 AM
the wiremock server is installed on a pod running on kubernetes, i am running my command from intelij i had upgrade my client to 2.35.0 jar
when i call it from postman with the same url it is ok…
r

Rob Elliot

03/30/2023, 9:23 AM
What version is the pod running?
s

Shlomy Sheps

03/30/2023, 9:34 AM
checking…
also 2.35.0
also when i am calling with curl from another pod thru http it is ok. it is something with the java client
r

Rob Elliot

03/30/2023, 9:38 AM
It’s a deserialisation error, so it’s probably how the json returned by the WireMock pod is turned into a Java object in your client
If you revert your client version does it work?
s

Shlomy Sheps

03/30/2023, 9:39 AM
to which version should i revert my client?
r

Rob Elliot

03/30/2023, 9:40 AM
Sorry, missed that it matches the pod, ignore that
No client side stacktrace for the deserialisation error?
s

Shlomy Sheps

03/30/2023, 9:43 AM
Copy code
Step failed
com.github.tomakehurst.wiremock.common.JsonException: {
  "errors" : [ {
    "code" : 10,
    "source" : {
      "pointer" : "/"
    },
    "title" : "Error parsing JSON",
    "detail" : "Cannot construct instance of `com.github.tomakehurst.wiremock.common.Errors` (although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (404)"
  } ]
}
	at com.github.tomakehurst.wiremock.common.JsonException.fromJackson(JsonException.java:53)
	at com.github.tomakehurst.wiremock.common.Json.read(Json.java:60)
	at com.github.tomakehurst.wiremock.client.HttpAdminClient.safelyExecuteRequest(HttpAdminClient.java:527)
	at com.github.tomakehurst.wiremock.client.HttpAdminClient.postJsonAssertOkAndReturnBody(HttpAdminClient.java:447)
	at com.github.tomakehurst.wiremock.client.HttpAdminClient.findTopNearMissesFor(HttpAdminClient.java:334)
	at com.github.tomakehurst.wiremock.client.WireMock.findAllNearMissesFor(WireMock.java:863)
	at com.github.tomakehurst.wiremock.client.WireMock.verificationExceptionForNearMisses(WireMock.java:677)
	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:670)
	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:650)
	at com.zebra.ima.tests.stepdefs.NuanceStepdefs.verifyMockEndpoint(NuanceStepdefs.java:165)
	at com.zebra.ima.tests.stepdefs.NuanceStepdefs.lambda$iVerifyWiremockReceivedCallOnPathTransactionOnlyTime$0(NuanceStepdefs.java:143)
	at org.awaitility.core.CallableCondition$ConditionEvaluationWrapper.eval(CallableCondition.java:99)
	at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:222)
	at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:209)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	at ✽.I verify wiremock received call on path /transaction/<TX_ID>/transactions/1/results only 1 time(file:///Users/shlomysheps/IdeaProjects/ima-e2e/service/src/main/resources/features/nuance-connector-e2e.feature:21)
this is the stacktrace from the client side…
r

Rob Elliot

03/30/2023, 10:02 AM
OK, so the admin client is getting back a client error where the body is just
404
... can you pop a breakpoint in at
HttpAdminClient.java:514
and check exactly what the method and URL is that the admin client is hitting?
s

Shlomy Sheps

03/30/2023, 10:12 AM
Copy code
try (CloseableHttpResponse response = httpClient.execute(request)) {
  int statusCode = response.getCode();
  if (HttpStatus.isServerError(statusCode)) {
    throw new VerificationException(
        "Expected status 2xx for " + url + " but was " + statusCode);
  }
I GOT 200
r

Rob Elliot

03/30/2023, 10:23 AM
I don't really understand what you're telling me there. Obviously you'll get to that line a lot (on every request that the client makes to the server) so it'll be 200 a lot.
s

Shlomy Sheps

03/30/2023, 10:32 AM
I debug it when the client is calling the count url and i got 200.. this is the problem it is very flaky once in a while the request pass..
getting 404 for this request: POST /__admin/near-misses/request-pattern
2 Views