Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Oracle Class not found !!  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!