Skip to content

Commit 7dfad4b

Browse files
weiqingyTom Graves
authored andcommitted
[SPARK-17710][HOTFIX] Fix ClassCircularityError in ReplSuite tests in Maven build: use 'Class.forName' instead of 'Utils.classForName'
## What changes were proposed in this pull request? Fix ClassCircularityError in ReplSuite tests when Spark is built by Maven build. ## How was this patch tested? (1) ``` build/mvn -DskipTests -Phadoop-2.3 -Pyarn -Phive -Phive-thriftserver -Pkinesis-asl -Pmesos clean package ``` Then test: ``` build/mvn -Dtest=none -DwildcardSuites=org.apache.spark.repl.ReplSuite test ``` ReplSuite tests passed (2) Manual Tests against some Spark applications in Yarn client mode and Yarn cluster mode. Need to check if spark caller contexts are written into HDFS hdfs-audit.log and Yarn RM audit log successfully. Author: Weiqing Yang <yangweiqing001@gmail.com> Closes #15286 from Sherry302/SPARK-16757.
1 parent 7d09232 commit 7dfad4b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/scala/org/apache/spark/util/Utils.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,8 +2489,10 @@ private[spark] class CallerContext(
24892489
def setCurrentContext(): Boolean = {
24902490
var succeed = false
24912491
try {
2492-
val callerContext = Utils.classForName("org.apache.hadoop.ipc.CallerContext")
2493-
val Builder = Utils.classForName("org.apache.hadoop.ipc.CallerContext$Builder")
2492+
// scalastyle:off classforname
2493+
val callerContext = Class.forName("org.apache.hadoop.ipc.CallerContext")
2494+
val Builder = Class.forName("org.apache.hadoop.ipc.CallerContext$Builder")
2495+
// scalastyle:on classforname
24942496
val builderInst = Builder.getConstructor(classOf[String]).newInstance(context)
24952497
val hdfsContext = Builder.getMethod("build").invoke(builderInst)
24962498
callerContext.getMethod("setCurrent", callerContext).invoke(null, hdfsContext)

0 commit comments

Comments
 (0)