Java – Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/logging/log4j/message/Message

javalog4jlogging

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/message/Message
at com.prac.Loger.(Loger.java:34)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.message.Message
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 1 more

Exception points to Loger.java:34

static Logger logger=Logger.getLogger(Loger.class);    

Please help me get rid of this exception…

Best Solution

Added log4j-api-2.1.jar and error is gone.!

Related Question