本文介绍了SQOOP无法导入表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述 我在sqoop上运行下面的命令
sqoop import --connect jdbc:mysql:// localhost / hadoopguide - table widgets
我的sqoop版本: Sqoop 1.4.4.2.0.6.1-101
Hadoop - Hadoop 2.2.0.2.0.6.0-101
从hortonworks distribution 。 HADOOP_HOME,HCAT_HOME,SQOOP_HOME等所有路径都设置正确。通过在sqoop中运行list-database,list-tables命令,我能够从mysql数据库中获取数据库列表和列表。即使能够从--query'select * from widgets'获取数据;但是当我使用--table选项获取低于错误。
14/02/06 14:02:17警告mapred.LocalJobRunner:job_local177721176_0001
java.lang.Exception:了java.lang.RuntimeException:抛出java.lang.ClassNotFoundException:JAVA:找不到类部件
在org.apache.hadoop.mapred.LocalJobRunner $ Job.run(LocalJobRunner.java:403)
所致。 lang.RuntimeException:java.lang.ClassNotFoundException:未找到类小部件
位于org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1720)
位于org.apache.sqoop.mapreduce。 db.DBConfiguration.getInputClass(DBConfiguration.java:394)
处org.apache.sqoop.mapreduce org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:233)
。 db.DBInputFormat.createRecordReader(DBInputFormat.java:236)LT
。在org.apache.hadoop.mapred.MapTask $ NewTrackingRecordReader&;初始化>(MapTask.java:491)
。在org.apache.hadoop .mapred.MapTask.runNewMapper(MapTask.java:734 )在org.apache.hadoop.mapred.MapTask.run(MapTask.java:339
)在org.apache.hadoop.mapred.LocalJobRunner $工作$ MapTaskRunnable.run
(LocalJobRunner.java:235 )
在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:439)$ b $在java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:303)
。在在在java.util中java.util.concurrent.ThreadPoolExecutor中的$ Worker.runTask(ThreadPoolExecutor.java:895)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
。 concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:918)
。在java.lang.Thread.run(Thread.java:662)
。通过引起:抛出java.lang.ClassNotFoundException:未发现类的小部件
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718)
... 13 more
解决方案使用
--bindir
选项并指向当前工作目录。sqoop import --bindir ./ --connect jdbc:mysql:// localhost / hadoopguide - 表单部件
I am running below command on sqoop
sqoop import --connect jdbc:mysql://localhost/hadoopguide --table widgets
my version of sqoop : Sqoop 1.4.4.2.0.6.1-101
Hadoop -- Hadoop 2.2.0.2.0.6.0-101
Both taken from hortonworks distribution. all the paths like HADOOP_HOME, HCAT_HOME, SQOOP_HOME are set properly. I am able to get list of databases, list of tables from mysql database by running list-database, list-tables commands in sqoop. Even able to get data from --query 'select * from widgets'; but when i use --table option getting below error.
14/02/06 14:02:17 WARN mapred.LocalJobRunner: job_local177721176_0001
java.lang.Exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class widgets not found
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:403)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class widgets not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1720)
at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:394)
at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:233)
at org.apache.sqoop.mapreduce.db.DBInputFormat.createRecordReader(DBInputFormat.java:236)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:491)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:734)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:339)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:235)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: Class widgets not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:1626)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:1718)
... 13 more
解决方案
Use the --bindir
option and point to your current working directory.
sqoop import --bindir ./ --connect jdbc:mysql://localhost/hadoopguide --table widgets
这篇关于SQOOP无法导入表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
06-17 19:53