[ 
https://issues.apache.org/jira/browse/HBASE-26546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17454829#comment-17454829
 ] 

Bryan Beaudreault commented on HBASE-26546:
-------------------------------------------

I'll give an implementation a shot. I mostly wanted to run this by you before 
proceeding, in case I was missing some context. Thanks!

> hbase-shaded-client missing required thirdparty classes under hadoop 3.3.1
> --------------------------------------------------------------------------
>
>                 Key: HBASE-26546
>                 URL: https://issues.apache.org/jira/browse/HBASE-26546
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Bryan Beaudreault
>            Priority: Major
>
> In HBASE-25792, the shaded thirdparty libraries from hadoop were removed from 
> the hbase-shaded-client fat jar to satisfy invariant checks. Unfortunately 
> this causes users of hbase-shaded-client to fail, because required classes 
> are not available at runtime.
> The specific failure I'm seeing is when trying to call new Configuration(), 
> which results in:
>  
>  
> {code:java}
> Caused by: java.lang.NoClassDefFoundError: 
> org/apache/hadoop/thirdparty/com/google/common/base/Preconditions   
>   at 
> org.apache.hadoop.conf.Configuration$DeprecationDelta.<init>(Configuration.java:430)
>    
>   at 
> org.apache.hadoop.conf.Configuration$DeprecationDelta.<init>(Configuration.java:443)
>    
>   at 
> org.apache.hadoop.conf.Configuration.<clinit>(Configuration.java:525){code}
>  
>  
> If you take a look at the hbase-shaded-client fat jar, it contains the 
> org.apache.hadoop.conf.Configuration class as you'd expect. If you decompile 
> that class (or look at the 3.3.1 source), you'll see that there is an import 
> for org.apache.hadoop.thirdparty.com.google.common.base.Preconditions but the 
> fat jar does not provide it.
>  
> One way for clients to get around this is to add an explicit dependency on 
> hadoop-shaded-guava, but this is problematic for a few reasons:
>  
> - it's best practice to use maven-dependency-plugin to disallow declared, 
> unused dependencies (which this would be)
> - it requires users to continually keep the version of hadoop-shaded-guava 
> up-to-date over time.
> - it only covers guava, but there is also protobuf and potentially other 
> shaded libraries in the future.
>  
> I think we should remove the exclusion of 
> {{org/apache/hadoop/thirdparty/**/*}} from the shading config and instead add 
> that pattern to the allowlist so that hbase-shaded-client is all clients need 
> to get started with hbase.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to