sqoop从mysql导入到hbase中:java.lang.NoSuchMethodError:org.apache.hadoop.hbase.client.HBaseAdmin

时间:2018-08-08 20:33:04

标签: mysql hbase sqoop

我的系统环境:

Ubuntu 18.04 LTS  (64bit)
Hadoop 2.7.6
HBase 2.0.1
Sqoop 1.4.7
openjdk version 1.8.0_171

启动hadoop服务和hbase之后, 我试图将mysql中的表导入hbase

/usr/local/sqoop/bin/sqoop  import 
      --connect jdbc:mysql://localhost:3306/TESTDB  
      --table mytable 
      --username <username> 
      --hbase-table hbmytable 
      --column-family  hbmytable_cf 
      --split-by ID 
      --hbase-create-table 
      --password ########

但是,导入失败,并显示以下错误消息:

......
18/08/08 18:41:28 INFO mapreduce.ImportJobBase: Beginning import of mytable
18/08/08 18:41:28 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
18/08/08 18:41:28 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hbase.client.HBaseAdmin.<init>(Lorg/apache/hadoop/conf/Configuration;)V
    at org.apache.sqoop.mapreduce.HBaseImportJob.jobSetup(HBaseImportJob.java:163)
    at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:268)
    at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:692)
    at org.apache.sqoop.manager.MySQLManager.importTable(MySQLManager.java:127)
    at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:520)
    at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    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)

有什么解决方法吗?

1 个答案:

答案 0 :(得分:0)

在将数据从MySQL导入到Hbase时,我也遇到了这个异常。

似乎依赖冲突。

我正在使用-

Hadoop - 3.2.0
Hbase - 2.2.0
Sqoop- 1.4.7

我已将以下提到的jar手动添加到SQOOP_HOME / lib-

1: hbase-client-1.2.0.jar
2: hbase-common-1.2.0.jar
3: hbase-mapreduce-2.2.0.jar
4: hbase-protocol-1.2.0.jar
5: hbase-server-1.2.0.jar
6: hbase-zookeeper-2.2.0.jar
7: protobuf-java-2.5.0.jar

Hbase导入工作正常。

**我正在使用Hbase 2.2.0,但仍必须使用所有Hbase-1.2.0 jar。