title: Tomcat does not recognize the MySQL .jar library
body: <p>I tried several different ways such that Tomcat loads the MySQL drivers when running my web application. I'm using Ubuntu 8.04, and the libraries come from the libmysql-java package. They are located in the directory shown below:</p>
  
  <pre>
  ~$ ls /usr/share/java/mysql*
  /usr/share/java/mysql-connector-java-5.1.5.jar
  </pre>
  
  <p>My CLASSPATH includes this file:</p>
  
  <pre>
  ~$ echo $CLASSPATH
  .:/usr/lib/jvm/java-6-sun/bin:/usr/local/tomcat/lib/servlet-api.jar:/usr/share/java/mysql-connector-java-5.1.5.jar
  </pre>
  
  <p>I even put a copy of the .jar file in my WEB-INF/lib/ directory in my web app:</p>
  
  <pre>
  /usr/local/tomcat/webapps/ohms/WEB-INF/lib$ ls
  mysql-connector-java-5.1.5.jar
  </pre>
  
  <p>After making these changes, I restart Tomcat, re-compile my classes, restart Tomcat again. Also, I am importing the necessary libraries using <code>import java.sql.*;</code></p>
  
  <p>However I am still getting the <code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver</code> error when it runs the line <code>Class.forName("com.mysql.jdbc.Driver").newInstance();</code></p>
  
  <p>What am I doing wrong here?</p>