1

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

8
  • Is there log4j.jar in your classpath ? Commented Nov 17, 2014 at 7:02
  • @sanDecruz following 2 jars in classpath:log4j-core-2.1.jar and log4j-1.2-api-2.1.jar Commented Nov 17, 2014 at 7:11
  • How did you try to print the log ? Can you show the code ? Commented Nov 17, 2014 at 7:12
  • i havent tried printing log . Commented Nov 17, 2014 at 7:13
  • it throws exception on mentioned line of code Commented Nov 17, 2014 at 7:14

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.