| Author |
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
|
anwar pasha
Greenhorn
Joined: Jun 10, 2008
Posts: 19
|
|
I am doing simple servlet and jdbc code to insert the data into database
when trying to insert the data i am getting below error ,
i have given mysql-connector.jar file in classpath still its comming the error
can help me please..........
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at DbCon.getConnection(DbCon.java:12)
at HelloAleemExample.doGet(HelloAleemExample.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
.
..
.
.
.
|
 |
Jan Cumps
Bartender
Joined: Dec 20, 2006
Posts: 2344
|
|
Check the documentation of your application server (is it Tomcat?). There will be a topic on how to add jar files to the classpath of that application server.
Typically, you have to place the jar file in a specific directory.
|
OCUP UML fundamental
ITIL foundation
|
 |
Mick Foley
Greenhorn
Joined: Mar 07, 2011
Posts: 4
|
|
|
If you are using Tomcat Web container, add your jar file under the WEB-INF/lib directory for your web application. Hope that works for you.
|
Never give up your goal
|
 |
uday kantt
Greenhorn
Joined: May 05, 2011
Posts: 23
|
|
Hi
So it is looking for a class called Driver in the com.mysql.jdbc package. For this you need to add the mysql-connector-java-5.0.8-bin.jar file to the classpath. Then things work fine.
Thanks
|
 |
 |
|
|
subject: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
|
|
|