title: Maven web project servlet class not found
body: <p>Just setup an eclipse project using Maven webapp architype. I created a servlet file and that got added to the resources folder under src/main/
  When I run the app tomcat gives an error:</p>
  
  <blockquote>
    <p>Error instantiating servlet class com.ABCompany.Demo.SampleDemo. java.lang.ClassNotFoundException: com.ABCompany.Demo.SampleDemo</p>
  </blockquote>
  
  <p>The file is under the folder src/main/resources/com/ABCompany/Demo/SampleDemo.java</p>
  
  <p>My web.xml is below.</p>
  
  <pre><code>&lt;web-app&gt;
   &lt;display-name&gt;Demo Example&lt;/display-name&gt;
   &lt;servlet&gt;
   &lt;servlet-name&gt;SampleDemo&lt;/servlet-name&gt;
   &lt;display-name&gt;SampleDemo&lt;/display-name&gt;
   &lt;description&gt;&lt;/description&gt;
   &lt;servlet-class&gt;com.ABCompany.Demo.SampleDemo&lt;/servlet-class&gt;
   &lt;/servlet&gt;
   &lt;servlet-mapping&gt;
   &lt;servlet-name&gt;SampleDemo&lt;/servlet-name&gt;
   &lt;url-pattern&gt;/SampleDemo&lt;/url-pattern&gt;
   &lt;/servlet-mapping&gt;
   &lt;welcome-file-list&gt;
   &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;     
   &lt;/welcome-file-list&gt;    
  &lt;/web-app&gt;
  </code></pre>