java. lang.IllegalAccessError: tried to access field org. slf4j. impl. StaticLoggerBinder. SINGLETON from class org. slf4j. LoggerFactory

Error record: Java lang.IllegalAccessError: tried to access field org. slf4j. impl. StaticLoggerBinder. SINGLETON from class org. slf4j. LoggerFactory

A colleague asked for an exception. I searched it and found an answer on stackoverflow:

This is about the version of slf4j-log4j12. You need to upgrade the slf4j API and slf4j-log4j12 to 1.5 6 +.

I right-click the project POM file and open it with eclipse POM editor. Click the dependency hierarchy interface, search for slf4j in the filter box, get the dependency tree about slf4j, and find that a module of the internal project uses hibernate 3 x. And Hibernate relies on slf4j1 Version 4.2.

Sure enough, this version is too low, so the following dependencies are added:

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.5</version>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.5</version>
</dependency>

Problem solving.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>