[
https://issues.apache.org/jira/browse/HBASE-30211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Junegunn Choi resolved HBASE-30211.
-----------------------------------
Fix Version/s: 4.0.0-alpha-1
2.7.0
3.1.0
3.0.1
2.6.8
2.5.17
Resolution: Fixed
Pushed to the following branches:
* master
* branch-3
* branch-3.0
* branch-2
* branch-2.6
* branch-2.5
Thanks to [~liuxiaocs7] for the review!
> hbase-shaded-client:2.x-hadoop3 DNS lookups raises
> DnsjavaInetAddressResolverProvider not found from Java18+
> ------------------------------------------------------------------------------------------------------------
>
> Key: HBASE-30211
> URL: https://issues.apache.org/jira/browse/HBASE-30211
> Project: HBase
> Issue Type: Bug
> Components: shading
> Affects Versions: 3.0.0, 2.5.16, 2.6.7
> Reporter: Allan Espinosa
> Assignee: Junegunn Choi
> Priority: Minor
> Labels: pull-request-available
> Fix For: 4.0.0-alpha-1, 2.7.0, 3.1.0, 3.0.1, 2.6.8, 2.5.17
>
>
> {{hbase-shaded-client:2.6.5-hadoop3}} is doesn't work on Java 18+ due to a
> broken {{ServiceLoader}} provider introduced by the shade plugin's class
> relocation. The shaded JAR poisons JVM-wide DNS resolution, causing every
> operation —
> including standard Kerberized HBase client connections — to fail.
> On Java 11, the same artifact works correctly for HBase operations
> (connecting to Kerberized clusters, listing namespaces). The regression is
> specific to Java 18+ where the {{java.net.spi.InetAddressResolverProvider}}
> SPI was introduced (JEP 418).
> h2. Failure message: ServiceLoader provider not found
> {code:java}
> java.util.ServiceConfigurationError: java.net.spi.InetAddressResolverProvider:
> Provider
> org.apache.hadoop.hbase.shaded.org.xbill.DNS.spi.DnsjavaInetAddressResolverProvider
> not found
> at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
> at
> java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219)
> at java.base/java.net.InetAddress.loadResolver(InetAddress.java:508)
> at java.base/java.net.InetAddress.resolver(InetAddress.java:488)
> {code:java}
> Hypothesis: The Maven shade plugin relocated {{org.xbill.DNS}} to
> {{org.apache.hadoop.hbase.shaded.org.xbill.DNS}}. The
> {{ServicesResourceTransformer}} rewrote the service file at
> {{META-INF/services/java.net.spi.InetAddressResolverProvider}} to
> reference the relocated class name. However, the JVM's {{ServiceLoader}}
> cannot load the provider at the relocated path. Since
> {{InetAddressResolverProvider}} is a JVM-level SPI, this breaks all DNS
> resolution in the process — not just Hadoop or
> HBase operations.
> h2. Steps to reproduce
> The following test connects to a Kerberized HBase cluster using only
> {{hbase-shaded-client:2.6.5-hadoop3} in its pom.xml. This code works in Java
> 11 but fails on Java 21:
> {code:java}
> @Test
> void kerberizedHBaseConnection() throws IOException {
> Configuration conf = new Configuration();
> // Makes UserGroupInformation.setConfiguration() work in the next line
> // conf.addResource("core-site.xml");
> conf.addResource(new URL("https://example.com/core-site.xml"));
> // On Java 11: succeeds
> // On Java 21: ServiceConfigurationError -
> DnsjavaInetAddressResolverProvider not found
> UserGroupInformation.setConfiguration(conf);
> Configuration hbaseConfig = HBaseConfiguration.create(conf);
> // On Java 11: succeeds
> // On Java 21: ServiceConfigurationError -
> DnsjavaInetAddressResolverProvider not found
> hbaseConfig.addResource(new URL("https://example.com/hbase-site.xml"));
> // No issue in Java 21:
> // hbaseConfig.addResource("hbase-site.xml");
> // On Java 11: succeeds
> // On Java 21: ServiceConfigurationError -
> DnsjavaInetAddressResolverProvider not found
> Connection conn = ConnectionFactory.createConnection(hbaseConfig);
> Admin admin = conn.getAdmin();
> assertTrue(List.of(admin.listNamespaces()).contains("default"));
> {code}
> h2. Workaround
> Use {{hbase-shaded-client-byo-hadoop}} with an explicit {{hadoop-client}}
> dependency instead
--
This message was sent by Atlassian Jira
(v8.20.10#820010)