IntelliJ IDEA出现错误Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

萝らか妹 提交于 2020-01-25 20:02:20

解决方案:

1、找到项目的pom.xml文件,添加依赖。如下图:

 

代码:

        <dependency>
            <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

        <dependency>
            <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>

2、然后运行clean清除一下缓存,如下图:

3、最后运行项目,就成功啦!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!