Diederick de Vries
02/20/2025, 11:53 AM{
"request": {
"method": "GET",
"url": "/locations"
},
"response": {
"status": 200,
"body": {
"content": "yes"
}
}
}
Starting WireMock fails after:
Exception in thread "main" com.github.tomakehurst.wiremock.standalone.MappingFileException: Error loading file /home/wiremock/./mappings/locatons.json:
Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.loadMappingsInto(JsonFileMappingsSource.java:126)
at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:288)
at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:282)
at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:143)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:68)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:71)
at wiremock.Run.main(Run.java:23)
exit status 1
When body
is just a string, Wiremock is starting. Is there a way to find out what exactly is the problem?Lee Turner
02/20/2025, 1:37 PMbody
is just for strings. If you want to specify the body as json as you are doing in your example, you need to use jsonBody
Diederick de Vries
02/20/2025, 1:38 PM