OracleDriver load fails from a Web Service On tomcat - Java

This is a discussion on OracleDriver load fails from a Web Service On tomcat - Java ; 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 ...

+ Reply to Thread
Results 1 to 7 of 7

OracleDriver load fails from a Web Service On tomcat

  1. Default OracleDriver load fails from a Web Service On tomcat

    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!


  2. Default Re: OracleDriver load fails from a Web Service On tomcat

    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


  3. Default Re: OracleDriver load fails from a Web Service On tomcat

    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.

    -cheers,
    Manish


  4. Default Re: OracleDriver load fails from a Web Service On tomcat

    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

  5. Default Re: OracleDriver load fails from a Web Service On tomcat

    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

  6. Default Re: OracleDriver load fails from a Web Service On tomcat

    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 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


  7. Default Re: OracleDriver load fails from a Web Service On tomcat

    =?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 about
    this in the Oracle Database JDBC Developer's Guide and Reference:
    http://download-uk.oracle.com/docs/c...a.htm#i1008205
    and a cross-compatibility list in the Oracle JDBC FAQ:
    http://www.oracle.com/technology/tec..._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.
    --
    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)

+ Reply to Thread

Similar Threads

  1. Tomcat - post upload fails for files over 320 KB
    By Application Development in forum Java
    Replies: 9
    Last Post: 12-12-2007, 07:19 AM
  2. ktux.dll fails to load
    By Application Development in forum Software-Testing
    Replies: 4
    Last Post: 03-30-2007, 03:25 AM
  3. XslCompiledTransform.Load() fails sometimes
    By Application Development in forum XML SOAP
    Replies: 0
    Last Post: 03-27-2007, 06:14 PM
  4. Replies: 1
    Last Post: 03-24-2007, 10:41 PM
  5. Bulk Load fails when run from windows service
    By Application Development in forum XML SOAP
    Replies: 0
    Last Post: 07-18-2006, 12:25 PM