• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mysql connector Class NotFound error

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means class path is not set properly. BTW when you face this error compile time or run time?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting the classpath, not in build path
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting the classpath
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using eclips IDE .How to set classpath using eclips.
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!

In Eclipse: Window > Preferences > Java > Build Path > Classpath Variables > New (or edit if you have one)
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But does your classes see that class? If you import com.mysql.jdbc.Driver an error is displayed or something like that?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.i put the
import com.mysql.jdbc.Driver;
but error is still remain.
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is happening for only web application
i used this methed(getcon()) in a java application.it is working.
 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic