Swapnil
Swapnil

Reputation: 1568

Exception : java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator

While running my application, below exception is thrown:

Jun 04, 2018 10:37:39 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.my.servlet.ContextListener
java.lang.NoClassDefFoundError: org/apache/log4j/PropertyConfigurator
    at com.my.servlet.ContextListener.contextInitialized(ContextListener.java:27)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)

Previously the application was working but after machine restart, it starts failing because of above error.

Upvotes: 0

Views: 830

Answers (1)

Abhishek
Abhishek

Reputation: 698

Well, you haven't said what kind of application this is or basically given us any context. You need to make sure that the log4j classes are available to the classloader which is loading your application. If it's a standalone application run from the commandline, that's like to just be a case of specifying the -classpath command-line option. For example:

java -classpath .;log4j-1.2.8.jar org.foo.MyApplication

If you can give us more information, we're likely to be able to help you more.

Upvotes: 1

Related Questions