• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Error registering a driver to mysql db when using Tomcat  RSS feed

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I dont know if this is a right forum for this topic. I have a web application deployed in tomcat. In the servlet, I am trying to register the "com.mysql.jdbc.Driver" using Class.forName, I am getting the following error

SEVERE: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1362)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)


But, when I run the unittest for the same, I get a sucessful connection instance com.mysql.jdbc.Connection@1acd47. I don't know what I am doing wrong.

Please help me here.

Thanks,

Karthik
 
Bartender
Posts: 2653
18
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Apache/Tomcat forum would be the right one.

Bbaseline is: you have to put the jdbc driver for MySQL into the correct tomcat directory. This depends on the version of tomcat you're using.

Go to http://tomcat.apache.org/.
Select Documentation for your version on the left side.
Select JDBC datasources.
Look for the sentence : copy the JDBC Driver's jar into
Copy your mysql jar there.

Regards, Jan
 
Get out of my mind! Look! A tiny ad!
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!