title: java- log4j- getting class not found
body: <p>I am using Log4j in a java web app.</p>
  
  <p>Now, when I run a servlet of that web app, this is the error message that I get-- </p>
  
  <p>description The server encountered an internal error () that prevented it from fulfilling this request.</p>
  
  <p>exception</p>
  
  <pre><code>javax.servlet.ServletException: Servlet execution threw an exception
  
  root cause
  
  java.lang.NoClassDefFoundError: org/apache/log4j/Logger
  com.test.ConfigHelper.&lt;clinit&gt;(ConfigHelper.java:45)
  com.test.runsinglecrawljob.doGet(runsinglecrawljob.java:126)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  
  root cause
  
  
  java.lang.ClassNotFoundException: org.apache.log4j.Logger
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
  org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
  com.test.ConfigHelper.&lt;clinit&gt;(ConfigHelper.java:45)
  com.test.runsinglecrawljob.doGet(runsinglecrawljob.java:126)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  </code></pre>
  
  <p>Now the line of code in ConfigHelper.java (line 45) is given below--- </p>
  
  <pre><code>protected static final Logger log = Logger.getLogger(ConfigHelper.class);
  </code></pre>
  
  <p>I checked Java Build Path-- the JAR file for log4j has been added to build path.</p>
  
  <p>What am I doing wrong here? How do I make log4j work without any problems?</p>