title: Ubuntu Tomcat7 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
body: <p>I'm trying to set up a JDBC DataSource in Tomcat 7 under Ubuntu 12.X, so I added the following to the context.xml file:</p>
  
  <pre><code>&lt;Resource name="jdbc/myDS" auth="Container" type="javax.sql.DataSource"
      maxActive="5" maxIdle="2" maxWait="5000"
      driverClassName="org.postgresql.Driver" username="usr" password="***" url="jdbc:postgresql://localhost:5432/db" /&gt;
  </code></pre>
  
  <p>Obviously, using the right and tested database user id and password. When I restart Tomcat, I get the this error:</p>
  
  <pre><code>Feb 05, 2013 1:10:01 PM org.apache.catalina.core.NamingContextListener addResource
  WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
  </code></pre>
  
  <p>I googled, and found out the JDBC driver has to be copied to the $CATALINA_HOME/lib folder, so I copied the postgresql-9.2-1000.jdbc4.jar to /usr/share/tomcat7/lib, but it didn't help. I tried copying the file to other locations, with the same results.</p>
  
  <p>Another attempt was to change the tomcat-dbcp.jar symlink in /usr/share/tomcat7/lib from ../../java/tomcat-dbcp-7.0.30.jar to ../../java/tomcat-dbcp.jar. The only change was I got only one warning instead of four, but the datasource doesn't work either.</p>
  
  <p>Java version:</p>
  
  <pre><code>jdoe@sever:~$ java -version
  java version "1.7.0_09"
  OpenJDK Runtime Environment (IcedTea7 2.3.4) (7u9-2.3.4-0ubuntu1.12.10.1)
  OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
  </code></pre>
  
  <p>Any hint, very welcomed.</p>
  
  <p>Cheers.</p>