本人在使用maven创建quickstart项目后,测试功能时出现 报错:

NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;L

查看开发日志,发现以下内容: 2022-08-12 21:14:36,287 [10577859] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

查看官网后发现 This warning, i.e. not an error, message is reported when no SLF4J providers could be found on the class path. Placing one (and only one) of slf4j-nop.jar slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem. Note that these providers must target slf4j-api 1.8 or later. 当在类路径上找不到SLF4J提供程序时,会报告此警告消息,即不是错误消息。放置一个(且仅一个)slf4j nop。jar和slf4j都很简单。jar、slf4j-log4j12.jar、slf4j-jdk14.jar或logback-classic。类路径上的jar应该可以解决这个问题。请注意,这些提供程序必须以slf4j api 1.8或更高版本为目标。

意思是,只能放一个版本。 在删除了一个slf4j-log4j12.jar后,调试发现仍然出错,所以我把slf4j.jar也删除了。 因为目前没有使用过slf4j,所以我觉得暴力删除也未尝不可。

参考文章

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: