Reputation: 834
I have seen many solutions in Stack Overflow but none of them worked for me. So I am getting this exception. My pom.xml code is here
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
I have added jar file in tomcat/lib folder also. But nothing is working for me.
Upvotes: 1
Views: 279
Reputation: 7838
You should rebuild your Maven project after adding new dependencies, either directly on Eclipse if you have the m2e built-in support (which you should, as explained and recommended in this question),
By right-clicking on the project name and then doing Maven->Update project
(as @BackSlash suggests)
Also, looking at your pom.xml
you are not nesting that <dependency>
inside the <dependencies>
tag, my db connector (postgress) looks something like this:
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.0.0.jre7</version>
</dependency>
... more <dependency> here...
</dependencies>
You can check this great link that explains how to write pom.xml
files when creating and building Java projects with Maven.
Edit:
Remember to call the driver exactly like "com.mysql.jdbc.Driver", with capital 'd'.
Upvotes: 1