我正在尝试为某些Spark代码创建一个Test。获取SparkSession对象时,以下代码失败。注意:从cli:gradle my_module:build
运行时,测试运行正常@Test
def myTest(): Unit = {
val spark = SparkSession.builder().master("local[2]").getOrCreate()
...
}
错误:
java.lang.IllegalArgumentException: Can't get Kerberos realm
...
Caused by: java.lang.reflect.InvocationTargetException
...
Caused by: KrbException: Cannot locate default realm
我的设置:IntelliJ + Gradle + Mac OS
问题:
答案 0 :(得分:0)
根据您的代码,您需要从JUnit运行Spark,而不是专门从IntelliJ运行,您可以尝试类似https://github.com/sleberknight/sparkjava-testing
的内容