{"id":2263,"date":"2023-10-02T10:55:12","date_gmt":"2023-10-02T02:55:12","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=2263"},"modified":"2023-10-31T15:41:34","modified_gmt":"2023-10-31T07:41:34","slug":"hbase-client-2-5-5-in-jdk-11","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=2263","title":{"rendered":"HBase Client 2.5.5 in JDK 11"},"content":{"rendered":"<p>Because of the vulnerability scan results of the project, the JDK version must be upgraded from 8 to 11 to complete the repair.<\/p>\n<p>The original HBase Client version 1.2 we used was incompatible with JDK 11, so we had to update the HBase Client version.<br \/>\nAfter 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.<\/p>\n<p>However, version 2.5.5 is still incompatible with JDK 11, so some adjustments must be made to make the service work properly.<br \/>\nReferring 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.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"\">&quot;--add-opens=java.base\/java.lang=ALL-UNNAMED&quot;<\/pre>\n<p>Due to the upgrade of HBase Client, &#8220;NoSuchColumnFamilyException&#8221; errors will occur in existing usage methods (such as using tableExists to confirm whether the table exists).<br \/>\nAfter 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.<\/p>\n<ol>\n<li>\n<p>Adjust checkTableExist method<\/p>\n<p>We first obtain all table information through &#8220;listTableDescriptors&#8221;, and then use this information to check whether it exists.<\/p>\n<\/li>\n<li>\n<p>Adjust isTableEnabled method (check whether table status is enabled)<\/p>\n<p>Use try-catch block to catch exceptions, and use the captured exceptions to determine whether the required state is already in place.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"\">try {\n    hbaseAdmin.disableTable(TABLE_NAME);\n} catch (TableNotEnabledException e) {\n    LOG.debug(&quot;TABLE_NAME is already disable&quot;);\n} catch (Exception e) {\n    throw e;\n}<\/pre>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=2263\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,51],"tags":[],"class_list":["post-2263","post","type-post","status-publish","format-standard","hentry","category-hbase","category-java"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/2263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2263"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/2263\/revisions"}],"predecessor-version":[{"id":2264,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/2263\/revisions\/2264"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}