Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOver…依赖冲突解决
项目报错内容为:
Exception in thread “main” java.lang.ExceptionInInitializerError
at org.apache.log4j.LogManager.getLogger(LogManager.java:44)
at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:66)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:657)
at org.apache.hadoop.conf.Configuration.(Configuration.java:173)
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting *Error. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
at org.apache.log4j.Log4jLoggerFactory.(Log4jLoggerFactory.java:49)
… 8 more
选择项目Maven右击
找到hadoop-client 双击进入将
org.slf4j
slf4j-log4j12
添加到pom.xml文件中 格式与其他的一致
建议手动加入标签添加
然后选择保存此文件 OK!