title: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
body: <p>Iam doing a project on spring MVC with maven.Iam getting an error java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource while running project.I include all the dependencies i think..below my codes.waiting for your reply</p>
  
  <p>WEB.xml</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"&gt;
    &lt;servlet&gt;
   &lt;servlet-name&gt;AccPerSpring&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/servlet-context.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;AccPerSpring&lt;/servlet-name&gt;
         &lt;url-pattern&gt;/&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
   &lt;/web-app&gt;
  </code></pre>
  
  <p>servlet-context.xml</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:mvc="http://www.springframework.org/schema/mvc"              xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"   xmlns:tx="http://www.springframework.org/schema/tx"
    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/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
     &lt;!-- Enable @Controller annotation support --&gt;
     &lt;mvc:annotation-driven /&gt;
  
  
     &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
           &lt;property name="prefix" value="/WEB-INF/" /&gt;
           &lt;property name="suffix" value=".jsp" /&gt;
     &lt;/bean&gt;
    &lt;context:component-scan base-package="com.gerrytan.pizzashop"/&gt;
    &lt;bean id="myDataSource" class=" org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; 
         &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
         &lt;property name="url" value="jdbc:mysql://localhost:3306/mydatabase"/&gt;
         &lt;property name="username" value="root"/&gt;
         &lt;property name="password" value="kca@fnpl#12"/&gt;
   &lt;/bean&gt;
  
       &lt;!-- Hibernate Session Factory --&gt;
      &lt;bean id="mySessionFactory"class="org.springframework.orm.hibernate4.LocalSessionFactoryBean&gt;
      &lt;property name="dataSource" ref="myDataSource"/&gt;
      &lt;property name="packagesToScan"&gt;
      &lt;array&gt;
       &lt;value&gt;com.gerrytan.pizzashop&lt;/value&gt;
      &lt;/array&gt;
     &lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
     &lt;value&gt;
      hibernate.dialect=org.hibernate.dialect.MySQLDialect
     &lt;/value&gt;
     &lt;/property&gt;
     &lt;/bean&gt;
  
      &lt;!-- Hibernate Transaction Manager --&gt;
      &lt;bean id="transactionManager"    class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="mySessionFactory"/&gt;
     &lt;/bean&gt;
  
     &lt;mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" /&gt;
     &lt;!-- Activates annotation based transaction management --&gt;
     &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
     &lt;/beans&gt;
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>     &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
       &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
       &lt;groupId&gt;AccPerSpring&lt;/groupId&gt;
       &lt;artifactId&gt;AccPerSpring&lt;/artifactId&gt;
        &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
       &lt;packaging&gt;war&lt;/packaging&gt;
  
       &lt;properties&gt;
       &lt;spring.version&gt;3.2.3.RELEASE&lt;/spring.version&gt;
        &lt;hibernate.version&gt;4.2.2.Final&lt;/hibernate.version&gt;
        &lt;/properties&gt;
  
      &lt;dependencies&gt;
       &lt;!-- Spring --&gt;
           &lt;dependency&gt;
           &lt;groupId&gt;org.springframework&lt;/groupId&gt;
           &lt;artifactId&gt;spring-context&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-webmvc&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-orm&lt;/artifactId&gt;
       &lt;version&gt;${spring.version}&lt;/version&gt;
     &lt;/dependency&gt;
  
  &lt;!-- Hibernate --&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
    &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
    &lt;version&gt;${hibernate.version}&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;!-- Java EE --&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
    &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
    &lt;version&gt;2.5&lt;/version&gt;
    &lt;scope&gt;provided&lt;/scope&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;!-- Others --&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
    &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
    &lt;version&gt;1.4&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.25&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;log4j&lt;/groupId&gt;
    &lt;artifactId&gt;log4j&lt;/artifactId&gt;
    &lt;version&gt;1.2.14&lt;/version&gt;
  &lt;/dependency&gt;
  
   &lt;/dependencies&gt;
  
     &lt;build&gt;
      &lt;plugins&gt;
       &lt;plugin&gt;
         &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
           &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
           &lt;version&gt;3.1&lt;/version&gt;
         &lt;configuration&gt;
          &lt;source&gt;1.7&lt;/source&gt;
          &lt;target&gt;1.7&lt;/target&gt;
         &lt;/configuration&gt;
       &lt;/plugin&gt;
       &lt;/plugins&gt;
       &lt;/build&gt;
    &lt;/project&gt;
  </code></pre>