Causes and solutions of java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log

Cause: This is a problem of jar package conflict. The project references a perverted jar package. This jar package contains many third-party packages, which leads to the conflict.
You can use the following method to confirm which package the conflict occurred in, and the specific jar package will be displayed in the output:

URL urlOfClass = App.class.getClassLoader().getResource(“org/slf4j/spi/LocationAwareLogger.class”); System.out.println
(urlOfClass); There can be two ways to solve the problem:

1. By modifying the content of the jar package and deleting unnecessary third-party packages, there are certain risks, but it is feasible

2. Put this conflicting package at the end of the reference, so that his third-party package will never be used unless there is no third-party package in the project

Guess you like

Origin blog.csdn.net/qq_39598825/article/details/124732804