Skip to content
Advertisement

Rest Assured – JSON Schema Validation – java.lang.NoSuchMethodError: com.github.fge.jsonschema.core.processing.CachingProcessor

I have generated schema for the the JSON response and have stored it in project directory .

Response resp1 = req.post("/pet");
    resp1.prettyPeek();
    resp1.then().body(JsonSchemaValidator
            .matchesJsonSchema(new File("/Users/srirams/DemoWorkspace/RestAssuredTraining/PetStoreScehma.json")));

No error shown in eclipse. But while running am getting below error. As it states method its looking for is not present. But I have imported the Jar which it shows as missing. Not sure if I am using incorrect version of that.

java.lang.NoSuchMethodError: com.github.fge.jsonschema.core.processing.CachingProcessor.

Dependencies used are:

io.rest-assured->io.rest-assured 3.3.0.
io.rest-assured-> json-schema-validator 3.3.0.
json 20180130
com.github.fge ->json-schema-core 1.2.5

When I search for answers, all I could see is just to add rest assured and json schema validator libraries which would be sufficient to test. But that’s not working for me. Anything to be changed with my dependencies/versions? Any suggestions would be really great .

Advertisement

Answer

I just use this version and it works fine.

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>4.3.3</version>
</dependency>

<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>4.3.1</version>
</dependency>
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement