java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger elasticsearch elasticsearch

java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger


to fix your issue, add following missing dependency:

  • org.apache.logging.log4j:log4j-api:2.8.2

aside, not directly related to issue, add following dependency so that your own calls to slf4j api get directed to log4j2 implementation also:

  • org.apache.logging.log4j:log4j-slf4j-impl:2.8.2

ensure no other log implementation is present on classpath.

note: the "extra" suggestion i made is based in that you want to redirect all your log calls to log4j, no matter if you are calling slf4j api or directly log4j. If not, please state which log implementatjon you would like, since then the OP listed depenedencies is also missing something.


Caused By: Cause: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger error indicates that, JVM is not able to found org.apache.log4j.Logger class in your project or application CLASSPATH. may be the reason of error is missing log4j.jar file into you project or class path. so you need to use below dependency:

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