OracleDriver load fails from a Web Service On tomcat

  • Follow


Hello, I have built a web service in eclipse. From one service, all I do istry {   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	atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)	atorg.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 tochange it to classes12.jar, I tried to put it under tomcat localdirectory and to point the path to there, but nothing worked.Interesting is the fact that if I run the same code exactly outsidethe web service method, for example from the test class main function,everything is fine. So I suspect it is a configurable issue. But whatis it???Thanks!
0
Reply jaja 10/24/2007 1:19:08 PM

On Oct 24, 6:19 am, jaja <dush...@012.net.il> wrote:> 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!Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.Do not change the extension to jar.-cheers,Manish
0
Reply Manish 10/24/2007 7:16:23 PM


On Oct 24, 12:16 pm, Manish Pandit <pandit.man...@gmail.com> wrote:>> Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.>> Do not change the extension to jar.>> -cheers,> ManishOops! My bad. I mistook Tomcat for JMeter. You can put classes12.jarin $TOMCAT_HOME/common/lib and then bounce Tomcat.-cheers,Manish
0
Reply Manish 10/24/2007 7:18:56 PM

jaja wrote:>  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> 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???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
0
Reply ISO 10/24/2007 9:55:58 PM

Manish Pandit wrote:> On Oct 24, 12:16 pm, Manish Pandit <pandit.man...@gmail.com> wrote:> >> 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.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.-- Lew
0
Reply Lew 10/25/2007 12:11:54 AM

Lew wrote:> Manish Pandit wrote:>> On Oct 24, 12:16 pm, Manish Pandit <pandit.man...@gmail.com> wrote:>>> Put classes12.jar in $TOMCAT_HOME/lib/ext and bounce Tomcat.>>>>>> Do not change the extension to jar.>>>> 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.Oracle 9i was first released in 2001. Java 1.4 was first releasedin 2002. I don't think Oracle released a Java 1.3 version (probablybecause there were no changes to JDBC in that release).So the 1.2 version could be the newest supported for thatdatabase version.The risk of running a new JDBC driver with an old databaseseems much greater than running an old JDBC driver with anew Java.Arne
0
Reply UTF 10/25/2007 1:10:31 AM

=?UTF-8?B?QXJuZSBWYWpow7hq?= <arne@vajhoej.dk> said:>Lew wrote:>> 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.>>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.According to Oracle, that is not the case. There's a statement aboutthis in the Oracle Database JDBC Developer's Guide and Reference:http://download-uk.oracle.com/docs/cd/B19306_01/java.102/b14355/getsta.htm#i1008205and a cross-compatibility list in the Oracle JDBC FAQ:http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#02_02I've been using both a 10g JDBC driver against an 8.1.7 db,and vice versa. And as with software in general, amount ofbugs does vary with versions - newest isn't always the best,but the oldest might not be, either. Find a version that worksfor your particular case, and be alert whenever you have tomigrate from the "known working" version.-- 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)
0
Reply Juha 10/27/2007 7:37:04 PM

6 Replies
424 Views

(page loaded in 0.126 seconds)

Similiar Articles:













7/23/2012 6:40:15 AM


Reply: