JAVA基础 - SLF4J: Class path contains multiple SLF4J bindings

告警描述

告警显示,在类路径下包含了多个SLF4J的绑定,然后选择了一个实现类。

[root@hm hook-bin]# ./import-hive.sh
Using Hive configuration directory [/opt/software/apache-hive-3.1.0-bin/conf]
Log file for import is /opt/software/apache-atlas-2.1.0/logs/import-hive.log
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/software/apache-hive-3.1.0-bin/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/software/hadoop-3.1.1/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]
NEXT IT WILL IMPORT THE HIVE'S META DATA!
2023-06-06T08:46:38,950 INFO [main] org.apache.atlas.ApplicationProperties - Looking for atlas-application.properties in classpath
2023-06-06T08:46:38,954 INFO [main] org.apache.atlas.ApplicationProperties - Loading atlas-application.properties from file:/opt/software/apache-hive-3.1.0-bin/conf/atlas-application.properties
2023-06-06T08:46:38,995 INFO [main] org.apache.atlas.ApplicationProperties - Using graphdb backend 'janus'
2023-06-06T08:46:38,995 INFO [main] org.apache.atlas.ApplicationProperties - Using storage backend 'hbase2'
2023-06-06T08:46:38,995 INFO [main] org.apache.atlas.ApplicationProperties - Using index backend 'solr'
2023-06-06T08:46:38,995 INFO [main] org.apache.atlas.ApplicationProperties - Atlas is running in MODE: PROD.
2023-06-06T08:46:38,995 INFO [main] org.apache.atlas.ApplicationProperties - Setting solr-wait-searcher property 'true'
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Setting index.search.map-name property 'false'
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Setting atlas.graph.index.search.max-result-set-size = 150
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Property (set to default) atlas.graph.cache.db-cache = true
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Property (set to default) atlas.graph.cache.db-cache-clean-wait = 20
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Property (set to default) atlas.graph.cache.db-cache-size = 0.5
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Property (set to default) atlas.graph.cache.tx-cache-size = 15000
2023-06-06T08:46:38,996 INFO [main] org.apache.atlas.ApplicationProperties - Property (set to default) atlas.graph.cache.tx-dirty-size = 120

如何解决

方案一

根据项目的实际情况,删除多余的JAR包,多个JAR包路径如下:

/opt/software/apache-hive-3.1.0-bin/lib/log4j-slf4j-impl-2.10.0.jar
/opt/software/hadoop-3.1.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar
方案二

查看项目的POM文件中是否有重复的SLF4J引入,如何查看?:

ROCKY@LAPTOP MINGW64 /d/02-工作空间/06-代码空间/04-gitee/rills-atlas-2.1.0-rc3/addons/hive-bridge (master)
$ mvn dependency:tree

找到多余的SLF4J,然后将其排除:

<dependency>
	<groupId>net.vcus</groupId>
	<artifactId>perf-case</artifactId>
	<version>1.0.0</version>
	<exclusions>
		<exclusion>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
		</exclusion>
	</exclusions>
</dependency>

猜你喜欢

转载自blog.csdn.net/goodjava2007/article/details/131060059
今日推荐