springboot整合hbase-client出现 multiple SLF4J bindings异常排查

主要是由于springboot与引入的中间件日志冲突,在hbase-client排除:

		<dependency>
			<groupId>org.apache.hbase</groupId>
			<artifactId>hbase-client</artifactId>
			<version>2.4.10</version>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-log4j12</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/javaFile/maven/mavenRpo/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/javaFile/maven/mavenRpo/ch/qos/logback/logback-classic/1.2.10/logback-classic-1.2.10.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.slf4j.impl.Reload4jLoggerFactory]
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.Reload4jLoggerFactory loaded from file:/D:/javaFile/maven/mavenRpo/org/slf4j/slf4j-reload4j/1.7.36/slf4j-reload4j-1.7.36.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.Reload4jLoggerFactory
	at org.springframework.util.Assert.instanceCheckFailed(Assert.java:702)
	at org.springframework.util.Assert.isInstanceOf(Assert.java:621)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:294)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:118)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:232)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:213)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:79)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$starting$0(SpringApplicationRunListeners.java:56)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
	at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:56)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:294)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
	at com.example.demo.DemoApplication.main(DemoApplication.java:10)

Process finished with exit code 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SLF4J: Class path contains multiple SLF4J bindings 是一个常见的错误,它表示在HBase中存在多个SLF4J(Simple Logging Facade for Java)的绑定。这个错误通常是由于引入了多个版本的SLF4J库而导致的。出现这个错误可能会导致一些问题,比如日志输出异常或日志丢失等。 解决这个问题的方法有几种: 1. 确认是否存在多个版本的SLF4J库。可以通过检查HBase的类路径或依赖项中是否存在多个SLF4J库来确定。在引用中的错误信息中可以看到具体的依赖项路径。确保只有一个版本的SLF4J库被引入。 2. 如果存在多个版本的SLF4J库,可以通过在项目的构建文件(如pom.xml)中排除或移除其中一个版本的库来解决冲突。具体的排除或移除方法取决于您使用的构建工具和项目结构。 3. 如果无法解决冲突,还可以尝试将所有的SLF4J库版本统一为同一个版本。这可以通过在项目的构建文件中显式地引入所需的版本来实现。 4. 另外,可以在启动HBase之前,检查系统的环境变量和类路径,确保没有重复引入SLF4J库的路径。 请注意,在解决这个问题之前,建议备份项目和配置文件,以防发生意外情况。另外,确保您的解决方案和步骤与您的具体环境和项目结构匹配。 希望这些方法可以帮助您解决SLF4J: Class path contains multiple SLF4J bindings的问题。如有其他问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值