我正在构建一个运行不同批处理流程的批处理引擎。对于其中一些过程,我不需要使用Spark。为此,我使用一个阴影插件来构建一个“ super ” jar,其中包含jar中的所有依赖项。
当我必须运行需要Spark的流程之一时,我可以运行spark Submit命令。但是jar中的Log4j与我服务器上的Spark安装冲突。我该如何解决?
SPARK_MAJOR_VERSION is set to 2, using Spark2
Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/usr/hdp/2.6.5.1217-7/spark2/jars/slf4j-log4j12-1.7.16.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.impl.Log4jLoggerFactory
最佳答案
在两个子项目上拆分项目-一个带有用于Spark的代码,另一个用于其他目的。
关于java - Spark安装与log4j冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62942340/