1

while reading multiline json file in Spark2.0 getting exception

val data = spark.read
    .option("multiline",true)
    .json("C:\\user\\Spark\\DataSets\\employees_multiLine.json")

Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.()V from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileInputFormat.java:262) at org.apache.spark.input.StreamFileInputFormat.setMinPartitions(PortableDataStream.scala:51) at org.apache.spark.rdd.BinaryFileRDD.getPartitions(BinaryFileRDD.scala:51) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:253) at org.apache.spark.rdd.RDD$$anonfun$partitions$2.apply(RDD.scala:251)

4
  • can you pls share your sample json data? I can attempt to build the solution using actual data. Commented Jul 19, 2020 at 12:47
  • 1
    From javadoc: this error can only occur at run time if the definition of a class has incompatibly changed. If you got it at run time, maybe you has invalid library dependence tree. There is any IDE or SBT warning? Commented Jul 19, 2020 at 15:50
  • @MikhailIonkin -- By adding google guava dependency it got resolved <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>15.0</version> </dependency> Commented Sep 27, 2020 at 5:24
  • @ShantanuKher here you go with nested json [ { "name": "Nish", "product": "Headphone", "Delivery": { "name": "Nisha", "address": "Chennai", "mob": "1234567" } }, { "name": "Gupta", "product": "T-shirt", "Delivery": { "name": "Guptans", "address": "Bangalore", "mob": "5738612" } } ] Commented Sep 27, 2020 at 5:31

1 Answer 1

2

Updating hadoop to 2.7.2 or higher will resolve this.

This issue is explained here in detail https://stackoverflow.com/a/36443787

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.