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.
- Check whether the Sqoop and HBase clients are in the same path.
- Log in to the node where the Sqoop client is installed as user root.
- Download the following JAR packages of HBase 1.6.0 and upload them to the lib directory on the Sqoop client:
- After the packages are uploaded, run the following command to change the permission on the packages to 755:
chmod 755 Package name
- Run the following command in the client directory to refresh the Sqoop client:
source bigdata_env
Run the target Sqoop command again.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.