0
votes

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...

1
Is there log4j.jar in your classpath ?Santhosh
@sanDecruz following 2 jars in classpath:log4j-core-2.1.jar and log4j-1.2-api-2.1.jarParUpadh
How did you try to print the log ? Can you show the code ?Santhosh
i havent tried printing log .ParUpadh
it throws exception on mentioned line of codeParUpadh

1 Answers

3
votes

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