当我使用Gson时,Jayway正在查找net.minidev类

时间:2016-02-05 03:27:07

标签: java json

我正在使用Gson编写一些我写的Jayway代码:

private static final Configuration JACKSON_CONFIGURATION = Configuration
        .builder()
        .mappingProvider(new GsonMappingProvider())
        .jsonProvider(new GsonJsonProvider())
        .build();

但是当我运行它时(尝试应用一些标准来选择JSON中的元素),发生了以下异常:

Exception in thread "main" java.lang.NoClassDefFoundError: net/minidev/json/writer/JsonReaderI
    at com.jayway.jsonpath.internal.DefaultsImpl.<init>(DefaultsImpl.java:17)
    at com.jayway.jsonpath.internal.DefaultsImpl.<clinit>(DefaultsImpl.java:15)
    at com.jayway.jsonpath.Configuration.getEffectiveDefaults(Configuration.java:48)
    at com.jayway.jsonpath.Configuration.access$000(Configuration.java:34)
    at com.jayway.jsonpath.Configuration$ConfigurationBuilder.build(Configuration.java:229)
    at com.jayway.jsonpath.internal.filter.ValueNode$PathNode.evaluate(ValueNode.java:778)
    at com.jayway.jsonpath.internal.filter.RelationalExpressionNode.apply(RelationalExpressionNode.java:37)
    at com.jayway.jsonpath.Criteria.apply(Criteria.java:57)
    at com.jayway.jsonpath.internal.path.PredicatePathToken.accept(PredicatePathToken.java:75)
    at com.jayway.jsonpath.internal.path.PredicatePathToken.evaluate(PredicatePathToken.java:59)
    at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
    at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:77)
    at com.jayway.jsonpath.internal.path.PathToken.handleArrayIndex(PathToken.java:133)
    at com.jayway.jsonpath.internal.path.ArrayPathToken.evaluateIndexOperation(ArrayPathToken.java:63)
    at com.jayway.jsonpath.internal.path.ArrayPathToken.evaluate(ArrayPathToken.java:52)
    at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81)
    at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:77)
    at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
    at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
    at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
    at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187)
    at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:164)
    at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:151)
    at com.wfx.wte.Test.fn(Test.java:44)
    at com.wfx.wte.Test.main(Test.java:32)
Caused by: java.lang.ClassNotFoundException: net.minidev.json.writer.JsonReaderI
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 25 more

似乎正在查找一些net.minidev类。有线索吗?

1 个答案:

答案 0 :(得分:0)

将net.minidev.json-smart添加到类路径中 如果需要,将net.mimidev.asm添加到类路径