title: ClassNotFoundException after adding the jar to the lib folder of a Tomcat Service installation
body: <p>I'm trying to update a web app to use DBCP. Things are running great locally (typical Tomcat on Windows installation). However, on the DEV server (EC2 LINUX AMI; Tomcat as a Service) I am getting the following</p>
  
  <pre><code>Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
  </code></pre>
  
  <p>I have narrowed this down (I think) to the <code>/lib</code> folder originally not having <code>tomcat-jdbc.ja</code>.</p>
  
  <p>I have since added this jar, and restarted the Tomcat instance with the following...</p>
  
  <pre><code>sudo service tomcat7 restart
  </code></pre>
  
  <p>However, I still get the same ClassNotFoundException. How can I get the Tomcat service to recognize <code>tomcat-dbcp.jar</code>?</p>
  
  <p>EDIT - Here's the stack trace when after running <code>sudo service tomcat7 start</code></p>
  
  <pre><code>Jan 20, 2014 5:30:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with JAR file [/usr/share/java/tomcat7/log4j.jar], exists: [false], canRead: [false]
  Jan 20, 2014 5:30:35 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with JAR file [/usr/share/java/tomcat7/log4j.jar], exists: [false], canRead: [false]
  Jan 20, 2014 5:30:36 PM org.apache.catalina.core.AprLifecycleListener init
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
  Jan 20, 2014 5:30:37 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8080"]
  Jan 20, 2014 5:30:37 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  Jan 20, 2014 5:30:37 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 1404 ms
  Jan 20, 2014 5:30:37 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Jan 20, 2014 5:30:37 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.40
  Jan 20, 2014 5:30:37 PM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive /var/lib/tomcat7/webapps/ROOT.war
  Jan 20, 2014 5:30:47 PM org.apache.catalina.core.StandardContext addApplicationListener
  INFO: The listener "org.apache.myfaces.webapp.StartupServletContextListener" is already configured for this context. The duplicate definition has been ignored.
  Jan 20, 2014 5:30:47 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]
  Jan 20, 2014 5:30:50 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8080"]
  Jan 20, 2014 5:30:50 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  Jan 20, 2014 5:30:50 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 12969 ms
  </code></pre>