Cannot load JDBC driver class 'com.mysql.jdbc.Driver' Tomcat 8 & Eclipse

Viewed 34035

Using tomcat 8 with Eclipse Cannot load JDBC driver class 'com.mysql.jdbc.Driver' ::: I have added mysql connecter every where and I still can't connect.

WEB-INF/lib/
Java Resources/Libraries/
tomcat/lib/  // however I don't see the jar file in my project 

enter image description here

enter image description here

web.xml

enter image description here

Tomcat Context.xml

enter image description here

5 Answers

Another thing you can try that worked for me is to add the mysql connector jar directly to the folder. Of course change to your environment.

C:[YOUR PATH]\apache-tomcat-8.5.24\lib

mysql-connector-java-5.1.45.jar

In my case I fixed this issue as it was happening with tomcat7 7.0.56 on debian 8.11 and apparently this tomcat7 version has some beef with this debian. When I downgraded to tomcat7 7.0.28 this error got fixed since jar was everywhere and only tomcat7 could have been the reason for not getting loaded. I hope this helps someone else save the time that I lost debugging this one

This comment is posted up and is fine but between steaps 2 and 3 you have to do step 2.50. You just forgot to import jar files into project path.

Give Right click on project

  1. go to properties
  2. click on java build path 2.50 In the right under Java Build Patch clickLibrary
  3. take add external jars
  4. choose mysql connector from zip file
  5. at last click apply and ok.
Related