File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes mysql connector Class NotFound error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "mysql connector Class NotFound error" Watch "mysql connector Class NotFound error" New topic
Author

mysql connector Class NotFound error

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
in my servlet there is a database connection.
if i put mysql connector.jar file to the lib folder in web.INF derectory then it is working.
but if i set the buildPath to the mysql connector using configureBuildPath it says class NotFound error?
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
That means class path is not set properly. BTW when you face this error compile time or run time?


My Blog
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,

That will not happen Put your mySql connection jar to your lib folder of web inf will automatically add to your build path.

Or if it will not add just right click on jar and select add to build path.



Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

aruna sameera wrote: but if i set the buildPath to the mysql connector using configureBuildPath it says class NotFound error?


Which context are you setting these? In IDE?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
no i mean if i put jar file to the lib folder it is working.
but if not doing that if i set the build path to the mysql.jar it gives class Not Found error
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
Try setting the classpath, not in build path
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
Try setting the classpath
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
I am using eclips IDE .How to set classpath using eclips.
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
Hi there!

In Eclipse: Window > Preferences > Java > Build Path > Classpath Variables > New (or edit if you have one)
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
this is my servlet



this is the error i got.
i set the class path to the mysql-connector.jar file using window-preference.......
but still error remain

Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
But does your classes see that class? If you import com.mysql.jdbc.Driver an error is displayed or something like that?
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
Yes.i put the
import com.mysql.jdbc.Driver;
but error is still remain.
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
this is happening for only web application
i used this methed(getcon()) in a java application.it is working.
Albareto McKenzie
Ranch Hand

Joined: Apr 08, 2009
Posts: 298
Ok, that seems to be that you don't have that librarie included in your project, you have to add it and the problem is gone.
 
wood burning stoves
 
subject: mysql connector Class NotFound error
 
Similar Threads
Passing List from Servlet to jsp ? - value of list becomes NULL
connectio null problem
Hibernate JDBC connection-cannot open
MYSQL Exception
Problems with Rad 7 and WAS 61 creating JDBC Provider for MySQL