[
https://issues.apache.org/jira/browse/HBASE-30503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated HBASE-30503:
-----------------------------------
Labels: pull-request-available (was: )
> Exclude forked jersey-json from client artifacts and binary distributions
> -------------------------------------------------------------------------
>
> Key: HBASE-30503
> URL: https://issues.apache.org/jira/browse/HBASE-30503
> Project: HBase
> Issue Type: Bug
> Components: build, dependencies, shading
> Affects Versions: 2.6.2, 2.6.7
> Reporter: mazhengxuan
> Assignee: mazhengxuan
> Priority: Major
> Labels: pull-request-available
>
> Hadoop 3.3.5 replaced com.sun.jersey:jersey-json with
> com.github.pjfanning:jersey-json. HBase still excludes the old coordinate, so
> the fork is included while jersey-core is excluded.
> The shaded client contains JAX-RS service providers whose parent classes are
> missing. Applications discovering these providers through ServiceLoader fail
> with NoClassDefFoundError. The fork also bypasses the binary assembly's
> com.sun.jersey:* exclusion.
> Confirmed with these released hbase-shaded-client artifacts:
> * 2.6.2-hadoop3 on JDK 8.
> * 2.6.7-hadoop3 on JDK 8, 11 and 17.
> To reproduce, download
> [hbase-shaded-client-2.6.7-hadoop3.jar|https://repo.maven.apache.org/maven2/org/apache/hbase/hbase-shaded-client/2.6.7-hadoop3/hbase-shaded-client-2.6.7-hadoop3.jar]
> and
> [javax.ws.rs-api-2.1.1.jar|https://repo.maven.apache.org/maven2/javax/ws/rs/javax.ws.rs-api/2.1.1/javax.ws.rs-api-2.1.1.jar]
> into the same directory, then save this as JerseySpiProbe.java:
> {code:java}
> import java.util.ServiceLoader;
> import javax.ws.rs.ext.MessageBodyWriter;
> public class JerseySpiProbe {
> public static void main(String[] args) {
> int count = 0;
> for (MessageBodyWriter<?> provider :
> ServiceLoader.load(MessageBodyWriter.class)) {
> System.out.println(provider.getClass().getName());
> count++;
> }
> System.out.println("Loaded providers: " + count);
> }
> }
> {code}
> Run:
> {code:bash}
> javac -cp javax.ws.rs-api-2.1.1.jar JerseySpiProbe.java
> # Passes: Loaded providers: 0
> java -cp .:javax.ws.rs-api-2.1.1.jar JerseySpiProbe
> # Fails after adding the HBase client
> java -cp .:javax.ws.rs-api-2.1.1.jar:hbase-shaded-client-2.6.7-hadoop3.jar
> JerseySpiProbe
> {code}
> The last command fails with:
> {noformat}
> java.lang.NoClassDefFoundError:
> org/apache/hadoop/hbase/shaded/com/sun/jersey/core/provider/jaxb/AbstractRootElementProvider
> {noformat}
> Adding the HBase client should not break JAX-RS provider discovery. The
> dependency and assembly exclusions should also cover the forked coordinate.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)