talha06
talha06

Reputation: 6466

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

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

Upvotes: 7

Views: 15212

Answers (6)

Minux
Minux

Reputation: 49

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

Upvotes: 0

Somum
Somum

Reputation: 2422

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.

Upvotes: 3

Bakhshi
Bakhshi

Reputation: 1339

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"

Upvotes: 2

raka
raka

Reputation: 133

@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.

Upvotes: 0

user2250033
user2250033

Reputation: 81

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.

Upvotes: 7

Laxmikanth Samudrala
Laxmikanth Samudrala

Reputation: 2243

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

Upvotes: 16

Related Questions