title: Servlet [mvc-dispatcher] in web application threw load() exception java.lang.ClassNotFoundException
body: <p>Hello I am new to spring and I was trying to build a simple spring MVC project 
  but when I am running my code I am getting: Servlet [mvc-dispatcher] in web application threw load() exception java.lang.ClassNotFoundException</p>
  
  <p>web.xml </p>
  
  <pre><code>    &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      version="2.5"&gt;
  
      &lt;display-name&gt;Sample Spring Maven Project&lt;/display-name&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;/WEB-INF/spring-config.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>spring-config.xml is</p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="UTF-8"?&gt;
       &lt;beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/ 2001/XMLSchema-instance"    xmlns:context="http://www.springframework.org/schema/context"
       xmlns:util="http://www.springframework.org/schema/util"    xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="http://www.springframework.org/schema/mvc  http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
       http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/util    http://www.springframework.org/schema/util/spring-util-3.2.xsd
      http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
     &lt;context:component-scan base-package="com.newproject.controller" /&gt;
     &lt;context:property-placeholder location="classpath:database.properties" /&gt;
     &lt;mvc:annotation-driven /&gt;
  
     &lt;bean id="dataSource"
      class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="${database.driver}" /&gt;
      &lt;property name="url" value="${database.url}" /&gt;
      &lt;property name="username" value="${database.user}" /&gt;
      &lt;property name="password" value="${database.password}" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sessionFactory"
      class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="annotatedClasses"&gt;  
              &lt;list&gt;  
                  &lt;value&gt;com.newproject.domain.Employee&lt;/value&gt;  
              &lt;/list&gt;  
          &lt;/property&gt; 
      &lt;property name="hibernateProperties"&gt;
       &lt;props&gt;
       &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/prop&gt;
       &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
       &lt;/props&gt;
       &lt;/property&gt;
       &lt;/bean&gt;
  
      &lt;bean id="txManager"
      class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="persistenceExceptionTranslationPostProcessor"
     class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostPro   cessor" /&gt;
  
      &lt;bean
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="prefix"&gt;
      &lt;value&gt;/WEB-INF/pages/&lt;/value&gt;
      &lt;/property&gt;
      &lt;property name="suffix"&gt;
       &lt;value&gt;.jsp&lt;/value&gt;
       &lt;/property&gt;
      &lt;/bean&gt;
  
  
     &lt;bean id="dataDaoImpl" class="com.newproject.dao.DataDaoImpl" /&gt;
      &lt;bean id="dataServiceImpl" class="com.newproject.services.DataServiceImpl"/&gt;
     &lt;/beans&gt;
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.newproject&lt;/groupId&gt;
    &lt;artifactId&gt;NewProject&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;name&gt;MyNewProject&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
    &lt;properties&gt;  
    &lt;spring.version&gt;4.0.5.RELEASE&lt;/spring.version&gt;  
    &lt;hibernate.version&gt;4.3.5.Final&lt;/hibernate.version&gt;  
    &lt;log4j.version&gt;1.2.17&lt;/log4j.version&gt;  
    &lt;jdk.version&gt;1.7&lt;/jdk.version&gt;  
    &lt;context.path&gt;SpringHibernateAnnotations&lt;/context.path&gt;  
   &lt;/properties&gt;  
   &lt;developers&gt;  
  
    &lt;developer&gt;  
     &lt;id&gt;Nagesh Chauhan&lt;/id&gt;  
     &lt;email&gt;beingjavaguy@gmail.com&lt;/email&gt;  
     &lt;organization&gt;beingjavaguys.com&lt;/organization&gt;  
     &lt;organizationUrl&gt;http://www.beingjavaguys.com&lt;/organizationUrl&gt;  
     &lt;roles&gt;  
      &lt;role&gt;Java Developer&lt;/role&gt;  
     &lt;/roles&gt;  
     &lt;timezone&gt;+5:30&lt;/timezone&gt;  
    &lt;/developer&gt;  
   &lt;/developers&gt;  
  
   &lt;build&gt;  
    &lt;finalName&gt;${pom.artifactId}&lt;/finalName&gt;  
  
    &lt;plugins&gt;  
     &lt;!-- Maven compiler plugin --&gt;  
     &lt;plugin&gt;  
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;  
      &lt;configuration&gt;  
       &lt;source&gt;${jdk.version}&lt;/source&gt;  
       &lt;target&gt;${jdk.version}&lt;/target&gt;  
      &lt;/configuration&gt;  
     &lt;/plugin&gt;  
    &lt;/plugins&gt;  
   &lt;/build&gt;  
   &lt;dependencies&gt;  
    &lt;dependency&gt;  
     &lt;groupId&gt;log4j&lt;/groupId&gt;  
     &lt;artifactId&gt;log4j&lt;/artifactId&gt;  
     &lt;version&gt;${log4j.version}&lt;/version&gt;  
    &lt;/dependency&gt;  
  
      &lt;dependency&gt;  
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
      &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;  
      &lt;version&gt;${spring.version}&lt;/version&gt;  
      &lt;/dependency&gt;  
      &lt;dependency&gt;  
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
      &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;  
      &lt;version&gt;${spring.version}&lt;/version&gt;  
      &lt;/dependency&gt;  
  
      &lt;dependency&gt;  
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
      &lt;artifactId&gt;spring-web&lt;/artifactId&gt;  
      &lt;version&gt;${spring.version}&lt;/version&gt;  
      &lt;/dependency&gt;  
  
    &lt;dependency&gt;  
     &lt;groupId&gt;org.hibernate&lt;/groupId&gt;  
     &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;  
     &lt;version&gt;${hibernate.version}&lt;/version&gt;  
    &lt;/dependency&gt;  
  
    &lt;dependency&gt;  
     &lt;groupId&gt;org.springframework&lt;/groupId&gt;  
     &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;  
     &lt;version&gt;${spring.version}&lt;/version&gt;  
    &lt;/dependency&gt;  
  
    &lt;dependency&gt;  
     &lt;groupId&gt;jstl&lt;/groupId&gt;  
     &lt;artifactId&gt;jstl&lt;/artifactId&gt;  
     &lt;version&gt;1.2&lt;/version&gt;  
    &lt;/dependency&gt;  
    &lt;dependency&gt;  
     &lt;groupId&gt;mysql&lt;/groupId&gt;  
     &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;  
     &lt;version&gt;5.1.6&lt;/version&gt;  
    &lt;/dependency&gt;  
  
  
    &lt;/dependencies&gt;  
    &lt;/project&gt;
  </code></pre>