我有一个使用 Spring 的项目,只要我在 pom.xml 文件中包含以下内容:<dependency><groupId>com.openshift</groupId><artifactId>openshift-restclient-java</artifactId><version>6.1.3.Final</version></dependency>我得到以下错误集。有想法该怎么解决这个吗?SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/Users/m/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/Users/m/.m2/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.Log4jLoggerFactory]The Class-Path manifest attribute in /Users/m/.m2/repository/org/liquibase/liquibase-core/3.5.5/liquibase-core-3.5.5.jar referenced one or more files that do not exist: file:/Users/m/.m2/repository/org/liquibase/liquibase-core/3.5.5/lib/snakeyaml-1.13.jarlog4j:WARN No appenders could be found for logger (org.springframework.boot.devtools.settings.DevToolsSettings).log4j:WARN Please initialize the log4j system properly.log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
1 回答
慕妹3242003
TA贡献1824条经验 获得超6个赞
Spring boot 和 Openshift 库都使用 slf4j,这是一个日志桥框架。但是,它们都包含不同的绑定:
Spring Boot 包含 Logbback
Openshift 包括 log4j
您可以通过排除其中任何一个来解决此问题,例如:
<!-- language: lang-xml -->
<dependency>
<groupId>com.openshift</groupId>
<artifactId>openshift-restclient-java</artifactId>
<version>6.1.3.Final</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
添加回答
举报
0/150
提交
取消
