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

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 561ba00e59 [#6906] fix(spark-connector):  Fix `No SLF4J providers` 
problem in spark-connector 3.3 (#9941)
561ba00e59 is described below

commit 561ba00e59e2e9c05d90a44d6ebd3ac2ba85b5f7
Author: Qi Yu <[email protected]>
AuthorDate: Wed Feb 11 10:47:37 2026 +0800

    [#6906] fix(spark-connector):  Fix `No SLF4J providers` problem in 
spark-connector 3.3 (#9941)
    
    ### What changes were proposed in this pull request?
    
    This pull request introduces a configuration update to the Gradle build
    file for the Spark connector. The main goal is to ensure consistent
    dependency resolution and prevent conflicts related to SLF4J and Log4j
    libraries.
    
    **Spark 3.4 & 3.5 do not have such problems.**
    
    ### Why are the changes needed?
    
    It's a bug.
    
    Fix: #6906
    
    ### Does this PR introduce _any_ user-facing change?
    
    N/A.
    
    ### How was this patch tested?
    
    Test locally.
---
 spark-connector/v3.3/spark/build.gradle.kts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/spark-connector/v3.3/spark/build.gradle.kts 
b/spark-connector/v3.3/spark/build.gradle.kts
index 04a85f710e..a8c47ea5a4 100644
--- a/spark-connector/v3.3/spark/build.gradle.kts
+++ b/spark-connector/v3.3/spark/build.gradle.kts
@@ -35,6 +35,7 @@ val paimonVersion: String = libs.versions.paimon.get()
 val kyuubiVersion: String = libs.versions.kyuubi4spark.get()
 val scalaJava8CompatVersion: String = libs.versions.scala.java.compat.get()
 val scalaCollectionCompatVersion: String = 
libs.versions.scala.collection.compat.get()
+val slf4j17Version = "1.7.36"
 val artifactName = 
"${rootProject.name}-spark-${sparkMajorVersion}_$scalaVersion"
 
 if (hasProperty("excludePackagesForSparkConnector")) {
@@ -42,6 +43,15 @@ if (hasProperty("excludePackagesForSparkConnector")) {
   configureFunc?.invoke(project)
 }
 
+configurations.matching { it.name in setOf("testRuntimeClasspath", 
"testCompileClasspath") }
+  .configureEach {
+    resolutionStrategy {
+      // Spark 3.3 pulls an SLF4J 1.7 binding; align slf4j-api to 1.7.x to 
avoid Log4j bridge conflicts.
+      force("org.slf4j:slf4j-api:$slf4j17Version")
+    }
+    exclude(group = "org.apache.logging.log4j", module = "log4j-slf4j2-impl")
+  }
+
 dependencies {
   implementation(project(":spark-connector:spark-common"))
   
compileOnly("org.apache.kyuubi:kyuubi-spark-connector-hive_$scalaVersion:$kyuubiVersion")

Reply via email to