Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected?

1.6k views Asked by At

I am using hadoop 1.0 and sqoop 1.4 which is compatible with each other. When I am trying to import a table from MySQL to hdfs.

sqoop import --connect jdbc:mysql://localhost/mydemo --table wordcount -m 1 --username root --password root123

I am getting following error

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected ?

I have tried running sqoop 1.4 with hadoop 1.0 and 2.0 still getting same error. I have tried sqoop 1.99 with hadoop 2.0 also. So please suggest some different suggestions other than compatibility.

2

There are 2 answers

0
generalpiston On

Sqoop and Sqoop2 have binary distributions that differ based on Hadoop version. This kind of error can be seen in Sqoop2 if it is compiled with the wrong version of Hadoop or if the wrong hadoop libraries are on your system. Things to try to fix this:

  1. Look for old hadoop jars that may make it into the classpath. find / -name 'hadoop*.jar' should work.
  2. Make sure you've downloaded a binary distrubtion of Sqoop. If you're using Hadoop2, download Sqoop2 for Hadoop2. If you're using Hadoop1 download Sqoop2 for Hadoop1.
  3. Explicitly set the classpath via the tomcat properties in <server configuration directory>/catalina.properties. Jars can be explicitly added to common.loader.
  4. If all else fails, reach out to the Sqoop mailing list.
0
isaiahbabu bandarupalli On

when you have installed sqoop tar file of hadoop version 1 in version 2, usually this error occurs. try to download sqoop tar file of hadoop version 2 and install it. issue will be resolved for sure. sqoop file for hadoop version 2 will look like below

sqoop-1.4.6.bin__**hadoop-2.0.4-**alpha.tar.gz