SQOOP Failed to import table

I run the command below on sqoop

sqoop import --connect jdbc:mysql://localhost/hadoopguide --table widgets

my sqoop version: Sqoop 1.4.4.2.0.6.1-101
Hadoop - Hadoop 2.2.0.2.0.6.0-101

Both are taken from the hortonworks distribution. all paths like HADOOP_HOME, HCAT_HOME, SQOOP_HOME are set correctly. I can get the list of databases, the list of tables from the mysql database by running the list-database, list-tables commands in sqoop. Even the ability to retrieve data from --query 'select * from widgets'; but when I use the -table option it gets below the 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
+3
source share
4 answers

Use the parameter --bindirand point to the current working directory.

sqoop import --bindir ./ --connect jdbc:mysql://localhost/hadoopguide --table widgets
+5
source

--bindir, .jar.

Sqoop Java .class .jar /tmp/sqoop-<username>/compile.

+4

, .class /tmp/sqoop-hduser/compile/ hdfs/home/hduser/, , sqoop.

0

hdfs, :

sqoop import --connect jdbc:mysql://localhost/databasename --username root --password *** --table tablename --bindir /usr/lib/sqoop/lib/ --driver com.mysql.jdbc.Driver --target-dir /directory-name

, /usr/lib/sqoop/* /usr/local/hadoop/* , , "Permission denied" .

PS. , mysql-java. 2.7.0 5.0.8

0

All Articles