1

I am trying to use Jayway JsonPath(2.4.0) Library in PIG UDF but while reading a JSON file , I am getting below exception. The code works perfectly over my local setup but when I package the code using maven and deploy it breaks.

Caused by: java.lang.NoSuchFieldError: defaultReader
    at com.jayway.jsonpath.spi.json.JsonSmartJsonProvider.<init>(JsonSmartJsonProvider.java:39)
    at com.jayway.jsonpath.internal.DefaultsImpl.jsonProvider(DefaultsImpl.java:21)
    at com.jayway.jsonpath.Configuration.defaultConfiguration(Configuration.java:174)
    at com.jayway.jsonpath.internal.ParseContextImpl.<init>(ParseContextImpl.java:21)
    at com.jayway.jsonpath.JsonPath.parse(JsonPath.java:599)
    at smartsuggest.imageproc.udf.ImageProcessorV2.retrieveImages(ImageProcessorV2.java:128)
Mridul Birla
  • 124
  • 11
  • I too was facing this issue, It turned out some other library was using json-smart's older version, and it was getting precedence over json-path's json-smart dependency. Removing the other jar solved the issue. Or you can also downgrade your json-path's version to appropriate version such that it support json-smart's older version. – best wishes Dec 18 '17 at 13:29
  • The solution: https://stackoverflow.com/questions/40954331/json-parser-java-lang-nosuchfielderror-defaultreader – fabiano.freitas Jan 22 '19 at 12:56

0 Answers0