This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new 05b5666406 [KYUUBI #6638] Shade jsr311-api in Authz
05b5666406 is described below

commit 05b566640698db9dd8ea227b7fa931a2aeac5f4d
Author: Cheng Pan <[email protected]>
AuthorDate: Fri Aug 23 00:40:35 2024 +0800

    [KYUUBI #6638] Shade jsr311-api in Authz
    
    # :mag: Description
    
    I faced the following error when trying to run authz with Spark 4.0
    ```
      Cause: java.lang.NoClassDefFoundError: javax/ws/rs/core/Cookie
      at java.base/java.lang.Class.forName0(Native Method)
      at java.base/java.lang.Class.forName(Class.java:375)
      at 
org.apache.ranger.plugin.policyengine.RangerPluginContext.createAdminClient(RangerPluginContext.java:96)
      at 
org.apache.ranger.plugin.util.PolicyRefresher.<init>(PolicyRefresher.java:90)
      at 
org.apache.ranger.plugin.service.RangerBasePlugin.init(RangerBasePlugin.java:251)
      at 
org.apache.kyuubi.plugin.spark.authz.ranger.SparkRangerAdminPlugin$.initialize(SparkRangerAdminPlugin.scala:68)
    ```
    
    The `javax.ws.rs:jsr311-api` is the transitive dep of `jersey-client`, we 
should shade and relocate it correctly.
    
    Why does it work with Spark 3? Spark 3 provides 
`jakarta.ws.rs:jakarta.ws.rs-api:2.1.6` which provides `java.ws.rs.*` classes, 
but Spark 4 upgrades to `jakarta.ws.rs:jakarta.ws.rs-api:3.0.0` which changed 
package name to`jakarta.ws.rs.*`.
    
    ## Types of changes :bookmark:
    
    - [x] Bugfix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ## Test Plan ๐Ÿงช
    
    Pass GHA and manually tested with Spark 4
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [x] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6638 from pan3793/jsr311.
    
    Closes #6638
    
    5699200cf [Cheng Pan] Shade jsr311-api in Authz
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 96ec1323ac8a113beb614bb89a47159ac82df5f5)
    Signed-off-by: Cheng Pan <[email protected]>
---
 extensions/spark/kyuubi-spark-authz-shaded/pom.xml | 4 ++++
 extensions/spark/kyuubi-spark-authz/pom.xml        | 6 ------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/extensions/spark/kyuubi-spark-authz-shaded/pom.xml 
b/extensions/spark/kyuubi-spark-authz-shaded/pom.xml
index 662c71a9f6..126072fcb6 100644
--- a/extensions/spark/kyuubi-spark-authz-shaded/pom.xml
+++ b/extensions/spark/kyuubi-spark-authz-shaded/pom.xml
@@ -92,6 +92,10 @@
                             <pattern>com.sun.ws.rs.ext</pattern>
                             
<shadedPattern>${kyuubi.shade.packageName}.com.sun.ws.rs.ext</shadedPattern>
                         </relocation>
+                        <relocation>
+                            <pattern>javax.ws.rs</pattern>
+                            
<shadedPattern>${kyuubi.shade.packageName}.javax.ws.rs</shadedPattern>
+                        </relocation>
                         <relocation>
                             <pattern>com.kstruct.gethostname4j</pattern>
                             
<shadedPattern>${kyuubi.shade.packageName}.com.kstruct.gethostname4j</shadedPattern>
diff --git a/extensions/spark/kyuubi-spark-authz/pom.xml 
b/extensions/spark/kyuubi-spark-authz/pom.xml
index 26655e0183..fde5f706d3 100644
--- a/extensions/spark/kyuubi-spark-authz/pom.xml
+++ b/extensions/spark/kyuubi-spark-authz/pom.xml
@@ -106,12 +106,6 @@
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-client</artifactId>
             <version>${jersey.client.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>javax.ws.rs</groupId>
-                    <artifactId>jsr311-api</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
 
         <dependency>

Reply via email to