• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class not found exception  RSS feed

 
Aashu Arya
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.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 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
 
David O'Meara
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.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • 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 Java Windows XP
  • 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?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66149
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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 ]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • 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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!