Support Questions

Find answers, ask questions, and share your expertise

Spark : java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat

avatar
Explorer

Hi Team,

 

I'm upgrading spark 2.1.1 to 2.2.1 and we had hadoop of 2.2.0. After changing spark 2.1.1 , I had to change hadoop version 2.7.2. Then it started throwing the following execption.

 

java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat

 

In our pom.xml we already have a version of guava.  

27.0.1-jre

 So I have added guava to exclusion list with no luck. I still get the same issue while running Junit (com.intellij.rt.junit.JUnitStarter.main)

 

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>

  

 

Any help would be very much appreciated

2 REPLIES 2

avatar
Explorer

I get the same error even after removing guava dependancy used in our project. I'm not sure how guava stopwatch is being started twice..

 

I still get the same error 

java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from class org.apache.hadoop.mapreduce.lib.input.FileInputFormat

avatar
Explorer

Hi All,

 

I have solved the issue after upgrading to hadoop client 2.7.2 and excluded transitive dependancy hadoop client 2.6.5 coming from spark jar

spark-core_2.11