HBase Client 2.5.5 in JDK 11

Because of the vulnerability scan results of the project, the JDK version must be upgraded from 8 to 11 to complete the repair.

The original HBase Client version 1.2 we used was incompatible with JDK 11, so we had to update the HBase Client version.
After collecting and comparing information on the Internet, I am planning to upgrade the HBase Client version to 2.5.5. The main reason why not choose a newer version (such as version 3) is that the difference between the versions is too big.

However, version 2.5.5 is still incompatible with JDK 11, so some adjustments must be made to make the service work properly.
Referring to the instructions at https://www.cnblogs.com/yjmyzz/p/hbase_client_with_jdk17.html, we must add this setting to the jvm startup parameters.

Due to the upgrade of HBase Client, “NoSuchColumnFamilyException” errors will occur in existing usage methods (such as using tableExists to confirm whether the table exists).
After referring to the relevant instructions on the Internet, this error is mainly due to the different table management mechanism of version 2.5.5 (https://stackoverflow.com/a/58498721). Therefore, the related usage methods need to be changed and adjusted.

  1. Adjust checkTableExist method

    We first obtain all table information through “listTableDescriptors”, and then use this information to check whether it exists.

  2. Adjust isTableEnabled method (check whether table status is enabled)

    Use try-catch block to catch exceptions, and use the captured exceptions to determine whether the required state is already in place.

This entry was posted in HBase, Java. Bookmark the permalink.