aspose file tools
The moose likes Servlets and the fly likes Oracle Class not found !! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Oracle Class not found !!" Watch "Oracle Class not found !!" New topic
Author

Oracle Class not found !!

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all,
I'm writing a small servlet which connects to a remote ORACLE 8i database. The class definition is:
Class.forName("oracle.jdbc.driver.OracleDriver");
But, when i run the servlet using tomcat, The ClassNotFoundException is fired and i get the following message:
"JDBC-ORACLE Class not found: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver"
What is wrong here and which file do i need or which path do i have to set and where. The OS is Windows2000.
Thanx
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
If you are depolying the zip under the WEB-INF/lib directory Tomcat will not find it. It needs to have a jar extention to be included. Unzip on your machine and jar it using the jar tool. Now when you put it back, things should work.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

As Carl mentions, you can place the jar'd version of the Oracle driver in your WEB-INF/lib directory.

I have an app that uses the zip version, but it's on my system CLASSPATH, which Tomcat seems to be able to use for this purpose.

I was under the impression it needed to be in WEB-INF/lib, and I had it there. But when Carl posted, I removed it and restarted the server, and my app still works.. so it must be getting it from the System CLASSPATH.

This is in Tomcat3.2.1
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

For the record, I just tried this with my Tomcat4.0.1 install, which doesn't seem to use the system CLASSPATH for anything.

I got the driver class not found error, then placed the zip file in my WEB-INF\lib directory and just changed the .zip to .jar. It worked
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I don't think there is a version online, only shipped with the tomcat 4 install, but the ClassLoader documentation is definitely worth a read.
Dave.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Also an excellent read on the topic of class loading is the WROX book "Professional JSP 2nd Edition". For those of you that have access to this book, and are interested, page 736-738 are very enlightening.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle Class not found !!
 
Similar Threads
JDBC thin driver
FOR HELP: Failed to connect to oracle in servlet
steps to installing Oracle jdbc driver
oracle. jdbc. driver. OracleDriver problem
FOR HELP, can not connect to Oracle using JDBC in servlet.