Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SLF4J:类路径包含多个SLF4J绑定Spring Maven_Spring_Spring Boot_Maven_Logging_Slf4j - Fatal编程技术网

SLF4J:类路径包含多个SLF4J绑定Spring Maven

SLF4J:类路径包含多个SLF4J绑定Spring Maven,spring,spring-boot,maven,logging,slf4j,Spring,Spring Boot,Maven,Logging,Slf4j,在将apache.mahout添加到pom.xml之后,我在运行spring项目时开始出现此警告,我想知道如何消除此警告 SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/Kapio/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4

在将apache.mahout添加到pom.xml之后,我在运行spring项目时开始出现此警告,我想知道如何消除此警告

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/Kapio/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/Kapio/.m2/repository/org/slf4j/slf4j-log4j12/1.7.30/slf4j-log4j12-1.7.30.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 [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
这是我的pom.xml

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.5.RELEASE</version>
        <relativePath/> 
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

            <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>

        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>

        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.mahout</groupId>
            <artifactId>mahout-mr</artifactId>
            <version>0.10.0</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

org.springframework.boot
spring启动程序父级
2.2.5.1发布
1.8
org.springframework.boot
spring启动程序数据mongodb
org.springframework.boot
弹簧启动安全
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机
org.springframework.security
弹簧安全性试验
测试
org.apache.mahout
收银员先生
0.10.0
org.springframework.boot
springbootmaven插件
我试图排除slf4j-log4j12,但仍然不工作,每次都有警告

<exclusions>
   <exclusion>
      <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>        
   </exclusion>
</exclusions>

org.slf4j
slf4j-log4j12
我到处找了找,没能把警告去掉

有什么建议吗

  • 你需要找出谁拉进了slf4j-log4j。在pom.xml目录中的命令行上执行“mvn:dependency:tree”,并找到将其拉入的依赖项
  • 将排除放在该依赖项上。全球排除不起作用
  • 这应该行得通

  • 在GitHub/GitLab/Bitbucket上有完整的工作示例吗?谢谢,我没有运行mvn:dependency:tree,但我知道mahout正在使用它,所以我从dependency apache.mahout中排除了它。