Help Center/ MapReduce Service/ Troubleshooting/ Using Sqoop/ Failed to Find the HBaseAdmin.<init> Method When Sqoop Reads Data from the MySQL Database to HBase
Updated on 2023-01-11 GMT+08:00

Failed to Find the HBaseAdmin.<init> Method When Sqoop Reads Data from the MySQL Database to HBase

Issue

If the Sqoop client (version 1.4.7) of MRS is used to extract data from a specified table in the MySQL database to a table in HBase 2.2.3, the following exception is reported:

Trying to load data into HBASE through Sqoop getting below error.
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hbase.client.HBaseAdmin.<init>(Lorg/apache/hadoop/conf/Configuration;)V

The following figure shows the complete exception information.

The following is an example of running the Sqoop command to extract data:

sqoop import \
--connect jdbc:mysql://mysqlServer address:Port number/database1 \
--username admin \
--password xxx \
--table table1 \
--hbase-table table2 \
--column-family info \
--hbase-row-key id \
--hbase-create-table --m 1

Procedure

After the Sqoop client is installed, the JAR packages on which HBase depends are not imported. You need to manually import the JAR packages on which HBase of an earlier version depends.

  1. Check whether the Sqoop and HBase clients are in the same path.

    • If yes, go to 2.
    • If no, delete the original Sqoop and HBase client files, download the complete clients from FusionInsight Manager, and install them in the same path. Then go to 2.

  1. Log in to the node where the Sqoop client is installed as user root.
  2. Download the following JAR packages of HBase 1.6.0 and upload them to the lib directory on the Sqoop client:

  3. After the packages are uploaded, run the following command to change the permission on the packages to 755:

    chmod 755 Package name

  4. Run the following command in the client directory to refresh the Sqoop client:

    source bigdata_env

    Run the target Sqoop command again.