安装sqoop-1.4.3-cdh4.5.0遇到找不到Sqoop类的异常
异常:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/sqoop/Sqoop
Caused by: java.lang.ClassNotFoundException: org.apache.sqoop.Sqoop
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
一看就是找不到jar包,这个问题困扰了我1天,各种修改改lib,没用,网上找到的英文资料也是修改lib都没用(版本太新,没有中文资料)。解决办法:
去$SQOOP_HOME/bin下,修改sqoop脚本:
修改前:exec ${Hadoop_COMMON_HOME}/bin/hadoop org.apache.sqoop.Sqoop "$@"
修改后:exec ${HADOOP_COMMON_HOME}/bin/hadoop jar $SQOOP_HOME/lib/sqoop-1.4.3-cdh4.5.0.jar org.apache.sqoop.Sqoop "$@"
由此可见,由于使用了hadoop命令,所以在安装sqoop-1.4.3-cdh4.5.0的机器上必选先安装hadoop
Sqoop 的详细介绍:请点这里
Sqoop 的下载地址:请点这里
相关阅读: