• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help

 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When I m trying to run my servlet from eclipse using JDBC coding I m getting ClassNotFoundException on line Class.forName("com.mysql.jdbc.Driver")

I have already placed mysql executable jar file into the build path of the project but still no luck.m I need to do anything else to make this class available?

Please help me to sort out the problem!

Thanks
Cherry
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That library needs to be in whatever classpath is used at runtime. (The build path is used at compile time, not runtime.)
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, please place your code inside the CODE tags
 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have put the jar file in libraries folder from where all other jar files are executed at runtime but still saying ClassNotFoundException.

Please help me out.

Thanks
Cherry
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Putting a jar file into a directory does not generally make that jar file available as part of the classpath. It does that only in certain circumstances, like if the directory in question is the WEB-INF/lib directory of a web app. Is that the case here? If it is, have you restarted the server, or at least the web app?
 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have put the jar file like this

Do I need to place the jar file somewhere else also?
problem.JPG
[Thumbnail for problem.JPG]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said, if it's a web app, then it needs to be in WEB-INF/lib.
 
Cherry Gupta
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still the same problem.

I had put the jar file in lib folder to but no luck.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Verify it's being deployed, however you're running the web app. Normally putting it in WEB-INF/lib would be enough.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cherry Gupta wrote:still the same problem.

I had put the jar file in lib folder to but no luck.


I think you need to double check everything. Are you sure you have the correct Jar? Open that Jar and make sure it contains the class your application is looking for.

Are you sure you've copied the Jar into the correct directory? You've said you copied it into a 'lib' directory, but not which lib directory.

Are you sure you re-build the application since making this change, then re-deployed it?

Are you creating War file for your application? Did you inspect the generated War file to make sure the Jar is actually in the correct location within the War file?

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cherry, please retitle you post with a better heading than "Need Help". It is assume that every post in this forum is from someone who needs help and if they all used your same heading, how would anyone be able to differentiate among posts? The title should be very specific as to the problem you are facing. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic