使用sqoop将数据从配置单元导出到mysql ClassNotFoundException:<表名> .class

时间:2018-06-30 08:36:54

标签: mysql hive sqoop

外壳:

bin/sqoop export --bindir ./
 --connect jdbc:mysql://localhost:3306/dbtaobao 
 --username root --password chengnuo1314521. 
 --table user_log 
 --export-dir '/user/hive/warehouse/dbtaobao.db/inner_user_log' 
 --fields-terminated-by ',';

,我可以看到jar和类目录: enter image description here

例外:

2018-06-30 15:51:55,492 INFO mapreduce.AutoProgressMapper: Auto-progress thread is finished. keepGoing=false
2018-06-30 15:51:55,495 INFO mapred.LocalJobRunner: map task executor complete.
2018-06-30 15:51:55,496 WARN mapred.LocalJobRunner: job_local1522330308_0001
java.lang.Exception: java.io.IOException: java.lang.ClassNotFoundException: user_log
    at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:492)
    at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:552)
Caused by: java.io.IOException: java.lang.ClassNotFoundException: user_log
    at org.apache.sqoop.mapreduce.TextExportMapper.setup(TextExportMapper.java:70)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:143)
    at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:799)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:347)
    at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:271)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: user_log
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    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)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.sqoop.mapreduce.TextExportMapper.setup(TextExportMapper.java:66)
    ... 10 more
...
2018-06-30 15:51:56,104 ERROR tool.ExportTool: Error during export: Export job failed!

我不知道天气原因是我的Mac,并且已经搜索了7个小时。我发现了一些类似的问题,因为“ Sqoop会将生成的Java源文件放置在当前工作目录和已编译的目录中。类文件和.jar文件放在/ tmp / sqoop- / compile中。”,但这不是我的问题。 对不起我的英语不好

1 个答案:

答案 0 :(得分:0)

可以使用hcatalog从配置单元表中导出sqoop。 示例命令是-

bin/sqoop export 
--connect jdbc:mysql://localhost:3306/dbtaobaz 
--username db --password db --table user_log 
--hcatalog-table user_log 
--fields-terminated-by ',';