我在spring boot申请中有以下错误:
SLF4J:类路径包含多个SLF4J绑定。slf4j:在[jar:file:/opt/tomcat/webapps/root/web-inf/lib/slf4j-simple-1.7.13.jar!/org/slf4j/impl/staticlogback-classic-1.1.3.jar!/org/slf4j/impl/staticloggerbinder.class]中找到绑定。
我转到链接,并试图从pom中删除slf4j-simple-1.7.13和logback-classic(我以为是导入的),但它不起作用。
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solrj.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
而且
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solrj.version}</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
Solr J版本:
<solrj.version>5.2.1</solrj.version>
如何确定这是否是正确的违规模块?是不是我做错了什么?
pom文件使用我们自己创建的spring boot父级。也许这就是需要排除的地方?
以下是org.slf4j的依赖关系树:
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ some-service ---
[INFO] com.company.io.some.service:some-service:war:1.0.0-SNAPSHOT
[INFO] +- com.company.io.commons:commons-mongo:jar:1.0.0:compile
[INFO] | \- com.company.io.commons:discovery-schema:jar:1.0.0:compile
[INFO] | +- com.company.io.commons:commons-schema:jar:1.0.0:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | +- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] | +- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] | | \- (org.com.company.io:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] | \- com.company.io.commons:commons-utils:jar:1.0.0:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] +- org.apache.solr:solr-solrj:jar:5.2.1:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.13:compile
[INFO] +- de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.5:test
[INFO] | \- de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.2:test
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:test - version managed from 1.7.10; omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.3.0.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-starter:jar:1.3.0.RELEASE:compile
[INFO] | \- org.springframework.boot:spring-boot-starter-logging:jar:1.3.0.RELEASE:compile
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.13:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.13:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] | \- org.slf4j:log4j-over-slf4j:jar:1.7.13:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] +- com.company.io.spring.boot.starter:central-config-spring-boot-starter:jar:1.0.0:compile
[INFO] | +- com.company.io.config:config-client:jar:1.0.0:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | +- io.springfox:springfox-swagger-ui:jar:2.2.2:compile
[INFO] | | \- io.springfox:springfox-spring-web:jar:2.2.2:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | \- io.springfox:springfox-swagger2:jar:2.2.2:compile
[INFO] | +- io.swagger:swagger-models:jar:1.5.3:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.6.3; omitted for duplicate)
[INFO] | +- io.springfox:springfox-spi:jar:2.2.2:compile
[INFO] | | \- io.springfox:springfox-core:jar:2.2.2:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | +- io.springfox:springfox-swagger-common:jar:2.2.2:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | +- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] | +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.10; omitted for duplicate)
[INFO] | \- org.springframework.hateoas:spring-hateoas:jar:0.19.0.RELEASE:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] +- com.company.io.spring.boot.starter:ana-spring-boot-starter:jar:1.0.0:compile
[INFO] | \- com.company.io.auth:ana-client:jar:1.2.0:compile
[INFO] | +- com.company.io.commons:commons-jersey:jar:1.0.0:compile
[INFO] | | \- com.company.io.commons:rules-schema:jar:1.0.0:compile
[INFO] | | +- com.company.io.commons:event-schema:jar:1.0.0:compile
[INFO] | | | +- com.company.io.commons:data-schema:jar:1.0.0:compile
[INFO] | | | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | | +- com.company.io.commons:notification-schema:jar:1.0.0:compile
[INFO] | | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.6; omitted for duplicate)
[INFO] | +- com.company.io.commons:commons-statsd:jar:1.0.0:compile
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | | \- org.slf4j:slf4j-simple:jar:1.7.13:compile (version managed from 1.7.12)
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.12; omitted for duplicate)
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] \- io.company.on.spring.boot.starter:metrics-spring-boot-starter:jar:1.0.0:compile
[INFO] +- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] +- io.dropwizard.metrics:metrics-annotation:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] +- io.dropwizard.metrics:metrics-healthchecks:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] +- io.dropwizard.metrics:metrics-json:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] +- io.dropwizard.metrics:metrics-jvm:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] +- io.dropwizard.metrics:metrics-servlet:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] +- io.dropwizard.metrics:metrics-servlets:jar:3.1.2:compile
[INFO] | \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] \- com.ryantenney.metrics:metrics-spring:jar:3.0.4:compile
[INFO] \- (org.slf4j:slf4j-api:jar:1.7.13:compile - version managed from 1.7.5; omitted for duplicate)
您是否尝试在POM中为org.slf4j:slf4j-simple
添加排除项,例如:
<dependency>
<groupId>com.company.io.spring.boot.starter</groupId>
<artifactId>ana-spring-boot-starter</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
在Hortonworks沙箱(HDP2.3Pig和Hive Rev6)中运行Hive查询时,我收到了这个警告。在这之后什么也没有发生。配置单元表也无法创建。怎么办?
当我尝试在eclipse中运行junit测试时,出现以下错误: SLF4J:类路径包含多个SLF4J绑定。SLF4J:在[jar: file:/C:/User/MaximilianBecker/. m2/repository/uk/org/lidalia/slf4j-test/1.2.0/slf4j-test-1.2.0.jar中找到绑定! /org/slf4j/impl/StaticLogger
我得到以下错误。似乎有多个日志记录框架绑定到SLF4J。不知道该怎么解决。非常感谢任何帮助。
我已经在我的应用程序中使用-SLF4J创建了cutom日志,如下链接:, http://javaeenotes.blogspot.com/2011/12/custom-slf4j-logger-adapter.html 它的工作与样本HelloWorldProgram这样很好, 但是如果我将它集成到maven项目中,使用spring创建日志文件, 我得到以下错误。尝试了许多不同的方法来解决这个问题
我在运行java代码时遇到以下运行时异常。有人能帮我解决绑定冲突吗。