springboot整合elasticsearch时,slf4j版本冲突

使用springboot整合elasticsearch时,自带的logback和其他jar自身引入的slf4j-simple产生了冲突

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/Program%20Files/maven/repository/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/Program%20Files/maven/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.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.SimpleLoggerFactory]
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.SimpleLoggerFactory loaded from file:/D:/Program%20Files/maven/repository/org/slf4j/slf4j-simple/1.7.25/slf4j-simple-1.7.25.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.SimpleLoggerFactory

解决方法:

1.用idea自带的maven图查看产生冲突的jar属于哪个pom文件

springboot整合elasticsearch时,slf4j版本冲突_第1张图片

2.排除不用的jar包(如果使用logback作为日志输出,就排除另外一个起冲突的jar)



org.slf4j
slf4j-simple

重新启动,问题已解决




 

转载于:https://www.cnblogs.com/TanShan/p/11282874.html

你可能感兴趣的:(大数据,java,开发工具)