[Solved]: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent



Problem Statement:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent    at java.lang.Class.getDeclaredMethods0(Native Method)    at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)    at java.lang.Class.privateGetPublicMethods(Class.java:2571)    at java.lang.Class.getMethods(Class.java:1429)    at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1261)    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1122)    at java.beans.Introspector.getBeanInfo(Introspector.java:414)    at java.beans.Introspector.getBeanInfo(Introspector.java:161)

Solution:

Logback-classic version 1.1.4 and later require slf4j-api version 1.7.15 or later.

With an earlier slf4j-api.jar in the classpath, attempting introspection of a Logger instance returned by logback version 1.1.4 or later will result in a NoClassDefFoundError similar to that shown below.

Placing slf4j-api.jar version 1.7.15 or later in the classpath should solve the issue.

Note that this problem only occurs with logback version 1.1.4 and later, other bindings such as slf4j-log4j, slf4j-jdk14 and slf4j-simple are unaffected.