Search This Blog

Loading...

Tuesday, August 23, 2011

Class not found Exception for com.mysql.jdbc.Driver

Hi,

When ever the ClassNotFoundException for com.mysql.jdbc.Driver,
make sure you have added the mysql-connector-java-5.1.17.jar (available on mysql site) in the jre/lib/ext directory.
I was using it with my maven build Spring MVC project and was cursing it unnecessarily.

Happy coding,
Shoeb

7 comments:

  1. This is too frequent an error. java.lang.ClassNotFoundException comes because ClassLoader fails to load the class requested at runtime.This is mostly an environmental issue which depends upon whether request class is present in Classpath or not.to solve this error best approach is to first find the jar file in which problematic class exists and then examine your classpath.also don't confuse this with NoClassDefFoundError which is entirely different , for details see here NoClassDefFoundError vs ClassNotFoundException in Java

    ReplyDelete
  2. It solves that issue....
    thanks.
    Jugal

    ReplyDelete
  3. Thank you! Your Post helped me solve my issue
    -Shanker

    ReplyDelete
  4. great help..thank u

    ReplyDelete
  5. i did add the connector in jre/lib/ext and jre/lib but still i m getting the same error.
    Plz help me on this, its very urgent

    ReplyDelete
  6. Yeeah it's pretty simple :) . Thank you, it solves my issue. Martin

    ReplyDelete
  7. i have already added jar file of mysql still the same error.............main thing is for some calls it is running.......for others it is not..............plz help me.......

    ReplyDelete