Sqoop之——Sqoop连接数据库报错(找不到org/apache/commons/lang/StringUtils)

转载请注明出处:https://blog.csdn.net/l1028386804/article/details/97135322

问题:

Sqoop连接数据库报错,报错信息为:

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.(SqlManager.java:89)
        at com.cloudera.sqoop.manager.SqlManager.(SqlManager.java:33)
        at org.apache.sqoop.manager.GenericJdbcManager.(GenericJdbcManager.java:51)
        at com.cloudera.sqoop.manager.GenericJdbcManager.(GenericJdbcManager.java:30)
        at org.apache.sqoop.manager.CatalogQueryManager.(CatalogQueryManager.java:46)
        at com.cloudera.sqoop.manager.CatalogQueryManager.(CatalogQueryManager.java:31)
        at org.apache.sqoop.manager.InformationSchemaManager.(InformationSchemaManager.java:38)
        at com.cloudera.sqoop.manager.InformationSchemaManager.(InformationSchemaManager.java:31)
        at org.apache.sqoop.manager.MySQLManager.(MySQLManager.java:65)
        at org.apache.sqoop.manager.DefaultManagerFactory.accept(DefaultManagerFactory.java:67)
        at org.apache.sqoop.ConnFactory.getManager(ConnFactory.java:184)
        at org.apache.sqoop.tool.BaseSqoopTool.init(BaseSqoopTool.java:272)
        at org.apache.sqoop.tool.ListDatabasesTool.run(ListDatabasesTool.java:44)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
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:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 20 more

解决方法:

在apache 上下载commons-lang-2.6.jar包并上传到lib下即可,下载地址:
http://mirrors.tuna.tsinghua.edu.cn/apache//commons/lang/binaries/commons-lang-2.6-bin.zip

 

 

 

你可能感兴趣的:(Hadoop,SQOOP,Hadoop生态)