Java.lang.ClassNotFoundException: Com.mysql.jdbc.Driver

I am getting java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in my dynamic web application even though I have set build path correctly in Eclipse for mysql connector. I am pretty sure that I have set built path correctly. I doubled checked that. I ran through so many same kind of questions in stackoverflow. All of them suggest to set build path in Eclipse. My question is, are there any other ways that can generate java.lang.ClassNotFoundException: com.mysql.jdbc.Driver error? If so , how to solve that? Thank you!



Keep your mysql-connector-java.jar file inside Web-INF folder -> lib and add it in classpath and then export your WAR and deploy.

This Documentation -


Therefore, from the perspective of a web application, class or resource loading looks in the following repositories, in this order:

  • Bootstrap classes of your JVM
  • /WEB-INF/classes of your web application
  • /WEB-INF/lib/*.jar of your web application <----------
  • System class loader classes (described above)
  • Common class loader classes (described above)