Moe
Moe

Reputation: 1537

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

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

Upvotes: 8

Views: 39799

Answers (5)

Daniel C
Daniel C

Reputation: 19

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.

Upvotes: 0

Iskren P.
Iskren P.

Reputation: 148

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

Upvotes: 0

user3008410
user3008410

Reputation: 848

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

Upvotes: 6

khaja firoz
khaja firoz

Reputation: 221

Give Right click on project

  1. go to properties
  2. click on java build path
  3. take add external jars
  4. choose mysql connector from zip file
  5. at last click apply and ok .

Upvotes: 1

josivan
josivan

Reputation: 2073

You need to add the mysql jar in classpath of Run Configurations.

Run Configuration

To do this choose menu Run > Run Configuration > Select your Tomcat Installation and the classpath tab. Click on button Add External JARs...

Upvotes: 10

Related Questions