Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

OracleDriver load fails from a Web Service On tomcat

Thread view: 
jaja - 24 Oct 2007 14:19 GMT
Hello,
I have built a web service in eclipse.

From one service, all I do is

try {
  Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
}

But then I get the following exception:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1340)
    at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1189)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)... etc...

I use Oracle 9.x, I have classes12.zip in my class path, I tries to
change it to classes12.jar, I tried to put it under tomcat local
directory and to point the path to there, but nothing worked.

Interesting is the fact that if I run the same code exactly outside
the web service method, for example from the test class main function,
everything is fine. So I suspect it is a configurable issue. But what
is it???

Thanks!
Manish Pandit - 24 Oct 2007 20:16 GMT
> Hello,
>  I have built a web service in eclipse.
[quoted text clipped - 30 lines]
>
> Thanks!

Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.

Do not change the extension to jar.

-cheers,
Manish
Manish Pandit - 24 Oct 2007 20:18 GMT
> Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.
>
> Do not change the extension to jar.
>
> -cheers,
> Manish

Oops! My bad. I mistook Tomcat for JMeter. You can put classes12.jar
in $TOMCAT_HOME/common/lib and then bounce Tomcat.

-cheers,
Manish
Lew - 25 Oct 2007 01:11 GMT
>> Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.
>>
[quoted text clipped - 5 lines]
> Oops! My bad. I mistook Tomcat for JMeter. You can put classes12.jar
> in $TOMCAT_HOME/common/lib and then bounce Tomcat.

Incidentally, classes12.jar is for Java 1.2 - pretty ancient, considering that
Java 1.3 is already obsolete and Java 1.4 is obsolescent.  Consider upgrading
to a current Oracle JDBC driver.

Signature

Lew

Arne Vajhøj - 25 Oct 2007 02:10 GMT
>>> Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.
>>>
[quoted text clipped - 6 lines]
> considering that Java 1.3 is already obsolete and Java 1.4 is
> obsolescent.  Consider upgrading to a current Oracle JDBC driver.

Oracle 9i was first released in 2001. Java 1.4 was first released
in 2002. I don't think Oracle released a Java 1.3 version (probably
because there were no changes to JDBC in that release).

So the 1.2 version could be the newest supported for that
database version.

The risk of running a new JDBC driver with an old database
seems much greater than running an old JDBC driver with a
new Java.

Arne
Juha Laiho - 27 Oct 2007 20:37 GMT
=?UTF-8?B?QXJuZSBWYWpow7hq?= <arne@vajhoej.dk> said:
>> Incidentally, classes12.jar is for Java 1.2 - pretty ancient,
>> considering that Java 1.3 is already obsolete and Java 1.4 is
[quoted text clipped - 6 lines]
>So the 1.2 version could be the newest supported for that
>database version.

According to Oracle, that is not the case. There's a statement about
this in the Oracle Database JDBC Developer's Guide and Reference:
http://download-uk.oracle.com/docs/cd/B19306_01/java.102/b14355/getsta.htm#i1008205
and a cross-compatibility list in the Oracle JDBC FAQ:
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#02_02

I've been using both a 10g JDBC driver against an 8.1.7 db,
and vice versa. And as with software in general, amount of
bugs does vary with versions - newest isn't always the best,
but the oldest might not be, either. Find a version that works
for your particular case, and be alert whenever you have to
migrate from the "known working" version.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

Arne Vajhøj - 24 Oct 2007 22:55 GMT
>  I have built a web service in eclipse.
>
>  From one service, all I do is

>    Class.forName("oracle.jdbc.driver.OracleDriver");

> But then I get the following exception:
> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

> I use Oracle 9.x, I have classes12.zip in my class path, I tries to
> change it to classes12.jar, I tried to put it under tomcat local
[quoted text clipped - 4 lines]
> everything is fine. So I suspect it is a configurable issue. But what
> is it???

I don't think Tomcat are using your CLASSPATH environment variable.

Try put the zip file in yourwebapp/WEB-INF/lib and restart the web app.

In general: never use the CLASSPATH environment variable.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.