Cannot Load Driver Class: Com.Mysql.Jdbc.Driver Spring Boot

Cannot load driver class: com.mysql.cj.jdbc.Driver

Have you checked which version of MySQL connector do you have?

Since you haven't specified the version in your pom.xml, there is a chance that it pulled version 5 and now it is complaining about that .cj which is required for version 8.

That might be the reason why is it working without .cj ( com.mysql.jdbc.Driver ), because it pulled the version 5.
Manually add the version in your pom.xml and keep .cj as it is.

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>

After that make sure that you pull your dependencies.
But make sure that you check in your project if you do have ONLY version 8 after "mvn clean install".

As of the picture that you shared "mysql version", that means nothing, the exception is regarding mysql-connector jar, it has nothing to do with the workbench, you can still have workbench version 5, and use mysql-connector jar version 8, it will make no difference.

In any version of mysql workbench ( 5 or 8 ):

mysql-connector 8 jar = requires .cj

mysql-connector 5 jar = does not require .cj

The only thing that you need to do is define the version of mysql-connector-java in your pom.xml

Failed to load driver class com.mysql.jdbc.Driver

The answer is so embarrassing. I appended the driver line of application.properties with a semicolon ...
Obviously, it did't recognize that driver.



Related Topics



Leave a reply



Submit