为什么sqoop在导入时抛出错误?

mzmfm0qo  于 2021-07-14  发布在  Spark
关注(0)|答案(1)|浏览(304)

我刚刚安装了sqoop并试图从mysql导入表,但它抛出了以下错误。我是sqoop的新手。

command -> sqoop import --connect jdbc:mysql://localhost:3306/test --username root --password Passw0rd --m 1 --table employee --target-dir /home/sayyad/Downloads/sqoop_data

2021-04-20 01:19:43,041 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
2021-04-20 01:19:43,204 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at org.apache.sqoop.manager.MySQLManager.initOptionDefaults(MySQLManager.java:73)
    at org.apache.sqoop.manager.SqlManager.<init>(SqlManager.java:89)

    at org.apache.sqoop.manager.InformationSchemaManager.<init>(InformationSchemaManager.java:38)
    at com.cloudera.sqoop.manager.InformationSchemaManager.<init>(InformationSchemaManager.java:31)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 20 more
anhgbhbe

anhgbhbe1#

在sqoop home的lib目录中可能没有commons-lang-2.6.jar
那你可以用 sqoop list-databases --connect jdbc:mysql://localhost:3306/test --username root -P 命令测试。

相关问题