[Solved]: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.

Problem Statement:

I have used slf4j libraries also to support logging end. Here I am getting an error

"Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.". 

Solution:

  1. Go to your pom.xml
  2. On the bottom tab click “Dependency Hierarchy” tab.
  3. From there search for log4j-over-slf4j.
  4. Exclude all instances of this dependency (right click on the instance and “Exclude Maven Artifact”).
  5. After you have no more log4j-over-slf4j appearing and have resaved try to run the program.
  6. If it still doesn’t work then undo the changes you just made (might be smart to backup your pom.xml in the beginning) and exclude all instances of slf4j-log4j12.