SLF4J: Class path contains multiple SLF4J bindings.——Hive启动输出

Posted Z.Q.Fengᯤ⁵ᴳ

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SLF4J: Class path contains multiple SLF4J bindings.——Hive启动输出相关的知识,希望对你有一定的参考价值。


项目场景:

系统:Ubuntu20.04
Hadoop版本:Hadoop3.3.1
Hbase版本:Hive3.1.2


问题描述:

在启动 Hive 时,出现如下输出:

hadoop@fzqs-Laptop:/usr/local/hive/lib$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

原因分析:

原因很简单,Hive 是自带有 Hadoop 中的相关依赖文件的,在本地装好 Hive 后,Hadoop 中的文件与 Hive 中的文件都有相关类的定义,从而导致如上输出。


解决方案:

删除 Hadoop(或 Hive)中相重复定义的文件,如上一条输出如下:

SLF4J: Found binding in [jar:file:/usr/local/hive/lib/log4j-slf4j-impl-2.10.0.jar!
/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!
/org/slf4j/impl/StaticLoggerBinder.class]

标红地方即是重复文件的位置,进入该位置:

cd /usr/local/hadoop/share/hadoop/common/lib
ls slf4j*

输出如下,

hadoop@fzqs-Laptop:/usr/local/hadoop/share/hadoop/common/lib$ ls slf4j*
slf4j-api-1.7.25.jar
slf4j-log4j12-1.7.25.jar

删除含有 logs 的文件即可:

sudo rm ./slf4j-log4j12-1.7.25.jar

以上是关于SLF4J: Class path contains multiple SLF4J bindings.——Hive启动输出的主要内容,如果未能解决你的问题,请参考以下文章

SLF4J: Class path contains multiple SLF4J bindings.警告解决

SLF4J: Class path contains multiple SLF4J bindings.

spark 与 Hadoop 融合后启动 slf4j提示Class path contains multiple SLF4J bindings

Hive客户端启动报SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Class path contains multiple SLF4J bindings.——Hbase启动输出

SLF4J: Class path contains multiple SLF4J bindings.——Hive启动输出