• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Oracle Class not found !!

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
it's a teeny, tiny, wafer thin ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic