java.lang.NoSuchFieldError:通过json模式验证器验证json模式时抛出USE_DEFAULTS

时间:2016-05-02 12:13:06

标签: json validation jackson schema

我是RestAPI测试的新手。我正在尝试使用Jsonschemavalidor。我添加了jar文件和所有依赖项。我仍然得到以下错误。任何人都可以解决这个问题。

Exception in thread "main" java.lang.NoSuchFieldError: USE_DEFAULTS
    at com.fasterxml.jackson.annotation.JsonInclude$Value.<clinit>(JsonInclude.java:205)
    at com.fasterxml.jackson.databind.cfg.MapperConfig.<clinit>(MapperConfig.java:45)
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:543)
    at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:460)
    at com.github.fge.jackson.JacksonUtils.newMapper(JacksonUtils.java:155)
    at com.github.fge.jackson.JacksonUtils.<clinit>(JacksonUtils.java:55)
    at com.github.fge.jackson.JsonNodeReader.<init>(JsonNodeReader.java:82)
    at com.github.fge.jackson.JsonLoader.<clinit>(JsonLoader.java:50)
    at com.jayway.restassured.module.jsv.JsonSchemaValidator$4.createJsonNodeInstance(JsonSchemaValidator.java:164)
    at com.jayway.restassured.module.jsv.JsonSchemaValidator$4.createJsonNodeInstance(JsonSchemaValidator.java:161)
    at com.jayway.restassured.module.jsv.JsonSchemaValidator$JsonSchemaValidatorFactory.create(JsonSchemaValidator.java:254)
    at com.jayway.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchema(JsonSchemaValidator.java:161)
    at com.jayway.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath(JsonSchemaValidator.java:117)
    at com.nasdaq.api.GenericLib.validateJsonSchema(GenericLib.java:441)

1 个答案:

答案 0 :(得分:13)

您是否添加了最新版本的jackson-annotations?在{2.6>

中添加了USE_DEFAULTS枚举常量

enter image description here