• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Driver not found

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All, I'm trying to integrate JDBC into my servlet.

I have a working JDBC example which simply runs a select and prints the results.

I also have a simple servlet which says hello.
So far so good.

However when I put the JDBC driver in the servlet init() method, I'm getting the exception java.lang.ClassNotFoundException: com.mysql.jdbc.Driver.

This is what is throwing the exception:


The compilation is working ok. Only when I upload my servlet class to the (tomcat) webserver, I'm getting a runtime exception.

I'm using Eclipse for development and am sure that the mySQL driver is in the build path.
Looks like the driver is present in the compile path but not runtime path. I have verified CLASSPATH and it does point to the driver jar file.

Suggestions?

Thanks,
Sashi
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat does not use your classpath variable.
Put the driver jar in the:
tomcat5: /common/lib/ folder
tomcat6: /lib

Restart tomcat.

Regards, Jan
 
Sasikanth Malladi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Worked like a charm!
Thanks, Jan.
Sashi
 
reply
    Bookmark Topic Watch Topic
  • New Topic