title: NoClassDefFoundError: org/apache/log4j/Logger
body: <p>I have used log4j logger in my java project and have the following in my <code>pom.xml</code>:</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.17&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I have added <code>log4j.properties</code> inside a directory named "resources" which I have added as a source in intelliJ project structure. </p>
  
  <p>When I build the project, it builds successfully. But when I try to run the <code>jar</code> file by running <code>java -jar myproject.jar</code>, it gives the following error.</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
      at org.wso2.confvalidator.ConfigValidator.&lt;clinit&gt;(ConfigValidator.java:40)
  Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 1 more
  </code></pre>