Hibernate - ClassNotFoundException: com.mysql.jdbc.Driver
For those who use Maven: add the following dependency in pom.xml.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
or choose another version from here.
Then you can get the artifact using:
mvn dependency:resolve
(if you don't use the IDE).
Thanks to Reimeus for the answer. mysql-connector-java-5.1.26-bin.jar
needs to be in the runtime classpath.
Run -> Run Configurations... -> Classpath -> Add external JAR.
Clean everything, try again, and the Exception is gone.
Faced the same issue with mysql-connector-java-5.1.48-bin.jar.
To fix this issue I changed the driver class name from
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
to
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>