增量导入时Sqoop作业执行错误

问题描述 投票:0回答:1

在运行Sqoop作业时,您可以帮助解决以下问题:我创建了一个Sqoop作业,如下所示:

sqoop job --create sqoop_inc_load -- import 
--connect jdbc:mysql://localhost/product_schema 
--username root 
--password root 
--table temp_value2 
--split-by department_id 
--target-dir /Sqoopimport/incm_load_new 
--append 
--incremental append 
--check-column department_id 
--last-value 0

创建作业后获得此输出:

19/03/16 18:27:55 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
19/03/16 18:27:56 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONObject
    at org.apache.sqoop.util.SqoopJsonUtil.getJsonStringforMap(SqoopJsonUtil.java:43)
    at org.apache.sqoop.SqoopOptions.writeProperties(SqoopOptions.java:785)
    at org.apache.sqoop.metastore.hsqldb.HsqldbJobStorage.createInternal(HsqldbJobStorage.java:399)
    at org.apache.sqoop.metastore.hsqldb.HsqldbJobStorage.create(HsqldbJobStorage.java:379)
    at org.apache.sqoop.tool.JobTool.createJob(JobTool.java:181)
    at org.apache.sqoop.tool.JobTool.run(JobTool.java:294)
    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.json.JSONObject
    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)

然后,我按如下方式执行了这项工作:

$ sqoop job --exec sqoop_inc_load

Warning: /usr/local/hadoop-env/sqoop-1.4.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/hadoop-env/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/hadoop-env/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/hadoop-env/sqoop-1.4.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
19/03/16 18:31:33 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
--table or --query is required for import. (Or use sqoop import-all-tables.)
Try --help for usage instructions.

得到上述消息,请你检查一下,让我知道我在哪里犯了什么错误?

import sqoop jobs
1个回答
0
投票

我们在使用增量追加时遇到了同样的错误。默认情况下,类名与表名相同。添加以下参数。

--class-name {table_name}

在你的情况下,会做。

--class-name temp_value2

更多细节可以在here找到

© www.soinside.com 2019 - 2024. All rights reserved.