• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Class not found exception

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I am using the JDBC in my servlet to retrieve some values from the database it is throwing this exception:

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

I have included the required jar files also but still it throwing the error.

I am using Eclipse Ganymede as the IDE and Tomcat as the container.

Please somebody help me solve it!

Aashu.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add the jar to tomcat/catalina/lib folder...

you are using jndi or jdbc basic step to connect DB
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True.
If you're managing your own Connections, the Oracle jar should be in the WEB-INF/lib directory, if the container is managing the Connections then it needs to be in the TOMCAT/common/lib or TOMCAT/lib directory, depending on your Tomcat version.
 
Aashu Arya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But I have that Already!
This is the path where I have copied the jar file

C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib

I would like to mention that when i am using the same JDBC in a .java class (of the same package)it is working fine but when I use that connection class in servlet to retrieve something from database it throws an exception.
 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it added to your build path, try right clicking the project in the project explorer... then properties-->Java build-path--> libraries'tab-->Add jars select the jar and click ok.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Akhilesh Trivedi:
Is it added to your build path, try right clicking the project in the project explorer... then properties-->Java build-path--> libraries'tab-->Add jars select the jar and click ok.



looks good
 
Aashu Arya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya Mate! I have already done that also!

I have again try to run it but it is still throwing an exception.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'an exception' is not very useful. Would you like to share it with us?
 
Aashu Arya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception is:

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you trying to obtain a connection?
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.

I have closed the duplicate in the JSP forum.
[ September 16, 2008: Message edited by: Bear Bibeault ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should really check if you have the right JAR file at the right place.

The only possible cause for this ClassNotFoundException is that the JAR file is not properly placed in the classpath at runtime.
 
Aashu Arya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok! thanks!
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic