7

I installed Hadoop, Hive, HBase, Sqoop and added them to the PATH.

When I try to execute sqoop command, I'm getting this error:

Error: Could not find or load main class org.apache.sqoop.Sqoop

Development Environment:

OS : Ubuntu 12.04 64-bit

Hadoop Version: 1.0.4

Hive Version: 0.9.0

Hbase Version: 0.94.5

Sqoop Version: 1.4.3

talha06
  • 6,206
  • 21
  • 92
  • 147

6 Answers6

16

make sure you have sqoop-1.4.3.jar under your SQOOP HOME directory.

Note : May be because you had downloaded wrong distribution under Sqoop Distribution

Laxmikanth Samudrala
  • 2,203
  • 5
  • 28
  • 45
7

I have resolved this issue on CentOS 6.3.
I have Hadoop-1.0.4, hbase-0.94.6, hive-0.10.0, pig-0.11.1, sqoop-1.4.3.bin__hadoop-1.0.0, zookeeper-3.4.5 installed.

I was also running same problem at sqoop: Error - Could not find the main class: org.apache.sqoop.Sqoop.

To resolve this issue I have copied the jar file: sqoop-1.4.3.jar from $SQOOP_HOME/ into the $HADOOP_HOME/lib/.

Hope this would help someone who struggling sqoop to be work with hadoop.

nhahtdh
  • 55,989
  • 15
  • 126
  • 162
3

Unfortunately, I didn't find a complete answer for my problems. Current sqoop installation version I used was 1.4.6 . I am not sure about sqoop-1.4.6.tar.gz if one has to compile the source code, I was able to beat the same error Error - Could not find the main class: org.apache.sqoop.Sqoop using following instructions:

Instead I downloaded sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz from apache sqoop and installed it at /home/ubuntu/SQOOP/ renamed sqoop-1.4.6.bin__hadoop-2.0.4-alpha to sqoop. I wanted to use with Yarn.

Then export and set $SQOOP_HOME I used this

export SQOOP_HOME=/home/ubuntu/SQOOP/sqoop/

export PATH=$PATH:$SQOOP_HOME/bin

Now if one go to $SQOOP_HOME/bin and try

./sqoop help

It should work without any issue.

Somum
  • 2,382
  • 26
  • 15
2

The problem in my case was that hadoop-env.sh file has this line in it:

export HADOOP_CLASSPATH=${JAVA_HOME}/lib/tools.jar

It seems that when you call sqoop it internally calls configure-sqoop which sets the HADOOP_CLASSPATH correctly but then when it (sqoop) calls hadoop, hadoop ignores that variable and reset it back to what is in hadooop-env.sh

The fix was to change the hadoop-env.sh to have this line instead:

export HADOOP_CLASSPATH="${JAVA_HOME}/lib/tools.jar:$HADOOP_CLASSPATH"
Bakhshi
  • 1,299
  • 16
  • 25
  • 1
    There seems to be also a typo in the version I downloaded: sqoop 1.4.6 - hadoop 2.0.4. It originally says JACA_HOME. I corrected it to JAVA_HOME and applied the solution above. It all worked! – midtownguru Sep 25 '16 at 18:07
0

@user225003 solution magically worked and I looked into some of the files and here is what happens under the hood when you execute "sqoop" script.

The "sqoop" script essentially executes "hadoop" script from $HADOOP_COMMON_HOME/bin/ directory. While configuring sqoop, in "sqoop-env.sh" we set the $HADOOP_COMMON_HOME to hadoop installation directory. If your sqoop and hadoop installations are not in regular location /usr/local, I believe sqoop-x.x.x.jar is not in the hadoop script's classpath.

raka
  • 133
  • 1
  • 4
  • 11
0

Download sqoop-1.4.7.jar file from here, and move it to $SQOOP_HOME/lib

Minux
  • 51
  • 1
  • 8