Solve java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

Recently I faced a problem regarding jdbc mySql connector. The error above kept popping in my Tomcat 7 console.

I created a web app using Maven 3 Spring 3 Hibernate 3 using the following URL:

Until now everything is great, but the error above popped again. Then in the project’s classpath in libraries tab I went to Add Variable and I chose Extend. In this window I added in M2_REPO the jar file from mysql folder in the repository. The console still displayed the same error.

After few minutes of searching I found the solution. The solution is that you have to copy the jar in lib folder from CATALINA_HOME.

So, although you’d expect MAVEN to handle this it seems it doesn’t so you have to do it manually.


Andrei Visan.


About javaxtendsolutions
Java programmer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: