Getting Exception java.lang.NoClassDefFoundError:

2019-08-04 05:44发布

问题:

I am trying to validate json using json schema validator and am using the following versions of jars:

  • json-schema-validator-2.1.8
  • json-schema-core-1.1.9
  • jackson coreutils 1.5
  • guava 16.0.1
  • jackson databind 2.2.3
  • jackson core 2.3.1
  • jackson anno 2.3.1

.

final JsonNode fstabSchema=Utils.loadResource("Schemas/JsonSchema/"+serviceName+".json");
final JsonNode jsonResponse = Utils.loadResource("Response/Json/devices_search_2.json");
final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();

final JsonSchema schema = factory.getJsonSchema(fstabSchema);

ProcessingReport report;
report=schema.validate(jsonResponse);
System.out.println(report);

I am getting this exception and I cant find out what I am missing. Any Help will be appreciated.

Exception in thread "main" java.lang.NoClassDefFoundError: com/github/fge/Frozen
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at validate.jsonValidator(validate.java:55)
    at validate.main(validate.java:74)
    Caused by: java.lang.ClassNotFoundException: com.github.fge.Frozen

I am not using json-schema-core 1.0.2 ( stable version ) because the binary is not available and I am not using maven.