运行程序时,idea报错如下:
ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:131)
at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.register(MetricsSystemImpl.java:232)
at org.apache.hadoop.metrics2.MetricsSystem.register(MetricsSystem.java:60)
at org.apache.hadoop.security.UserGroupInformation$UgiMetrics.create(UserGroupInformation.java:121)
at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:237)
at org.apache.spark.util.Utils$$anonfun$getCurrentUserName$1.apply(Utils.scala:2406)
at org.apache.spark.util.Utils$$anonfun$getCurrentUserName$1.apply(Utils.scala:2406)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.util.Utils$.getCurrentUserName(Utils.scala:2406)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:295)
at com.air.antispider.stream.dataprocess.launch.DataProcessLauncher$.main(DataProcessLauncher.scala:20)
at com.air.antispider.stream.dataprocess.launch.DataProcessLauncher.main(DataProcessLauncher.scala)
报错信息很明显,是log4j的包冲突了,注释掉父类工程的log4j依赖即可。
注意:maven工程导入依赖的时候注意父类和子类之间的包冲突。