Having a problem loading my driver from a test servlet, the error simply being
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Running the servlet via tomcat - which is running without issue as the localhost:8080 page is showing up in the browser. The servlet is attempting to connect to a database running in MySQL workbench.
Code within my servlet class, which attempts to load the driver:
String driver = "com.mysql.jdbc.Driver";
Class.forName(driver).newInstance();
// Make db connection
con = DriverManager.getConnection(url, USERNAME, PASSWORD);
st = con.createStatement();
System variables are setup as follows:
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_02\
CLASSPATH: C:\apache-tomcat-6.0.35\lib\servlet-api.jar;C:\ProgramFiles\Java\jre7\lib\mysql-connector-java-5.1.22-bin;
PATH: C:\Program Files\Java\jdk1.7.0_02\bin
Now, as far as I can see, everything looks to be setup correctly. I would appreciate any input as to what may be causing the issue as I'm rather clueless as how else to troubleshoot this one.
Many thanks.