Re: [DBCP] - ClassNotFoundException with Oracle

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [DBCP] - ClassNotFoundException with Oracle

Atif Faridi
Perhaps my unsophisticated solution will save someone else the 3-hours
it cost me to come up with it.

I was also getting the infamous

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

while programming in Tomcat using DBCP via Spring.

I unsuccessfully tried a number of posted solutions including adding
nls_charset12.zip to my classpath and including the Oracle JDBC driver
in WEB-INF/lib/.

In a fit of desperation found that unzipping the classes12.zip archive
and then "jarring" the archive contents fixed my problem. That is,

[~/tmp/oracle/jdbc]: ls -F
classes12.zip*
[~/tmp/oracle/jdbc]: unzip classes12.zip
Archive:  classes12.zip
   creating: oracle/
   creating: oracle/sql/
 extracting: oracle/sql/ARRAY.class
...
[~/tmp/oracle/jdbc]: ls -F
classes12.zip*  javax/  oracle/
[~/tmp/oracle/jdbc]: jar cvf oracle-jdbc.jar javax/ oracle/
added manifest
adding: javax/(in = 0) (out= 0)(stored 0%)
adding: javax/sql/(in = 0) (out= 0)(stored 0%)
adding: javax/sql/ConnectionEvent.class(in = 546) (out= 317)(deflated 41%)
...
[~/tmp/oracle/jdbc]: rm ~/dev/eof-ws/lib/classes12.zip
[~/tmp/oracle/jdbc]: cp oracle-jdbc.jar ~/dev/eof-ws/lib/

I have not gone deeper into the reason for this goofy solution, but it
definitely worked. I'm guessing it has something to do with the web
app class loader.

Here are the software components describing my environment:

OS:
Microsoft Windows XP

DBMS:
Oracle8i Enterprise Edition Release 8.1.7.4.1
Oracle JDBC Drivers 8.1.7.1 for 8i

Java jonx:
JDK 5.0 - VM version 1.5.0_03
Apache Tomcat 5.5.9
Spring 1.4.1
Commons DBCP 1.2.1

Hope this helps.

Regards,
Atif Faridi

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [DBCP] - ClassNotFoundException with Oracle

Chris Cheshire
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html

See the Oracle 8i section. This hasn't changed since I configured a
Tomcat 4 installation. It tells you exactly what you stumbled across
yourself.


On 7/25/05, Atif Faridi <[hidden email]> wrote:

> Perhaps my unsophisticated solution will save someone else the 3-hours
> it cost me to come up with it.
>
> I was also getting the infamous
>
> java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
>
> while programming in Tomcat using DBCP via Spring.
>
> I unsuccessfully tried a number of posted solutions including adding
> nls_charset12.zip to my classpath and including the Oracle JDBC driver
> in WEB-INF/lib/.
>
> In a fit of desperation found that unzipping the classes12.zip archive
> and then "jarring" the archive contents fixed my problem. That is,
>
> [~/tmp/oracle/jdbc]: ls -F
> classes12.zip*
> [~/tmp/oracle/jdbc]: unzip classes12.zip
> Archive:  classes12.zip
>    creating: oracle/
>    creating: oracle/sql/
>  extracting: oracle/sql/ARRAY.class
> ...
> [~/tmp/oracle/jdbc]: ls -F
> classes12.zip*  javax/  oracle/
> [~/tmp/oracle/jdbc]: jar cvf oracle-jdbc.jar javax/ oracle/
> added manifest
> adding: javax/(in = 0) (out= 0)(stored 0%)
> adding: javax/sql/(in = 0) (out= 0)(stored 0%)
> adding: javax/sql/ConnectionEvent.class(in = 546) (out= 317)(deflated 41%)
> ...
> [~/tmp/oracle/jdbc]: rm ~/dev/eof-ws/lib/classes12.zip
> [~/tmp/oracle/jdbc]: cp oracle-jdbc.jar ~/dev/eof-ws/lib/
>
> I have not gone deeper into the reason for this goofy solution, but it
> definitely worked. I'm guessing it has something to do with the web
> app class loader.
>
> Here are the software components describing my environment:
>
> OS:
> Microsoft Windows XP
>
> DBMS:
> Oracle8i Enterprise Edition Release 8.1.7.4.1
> Oracle JDBC Drivers 8.1.7.1 for 8i
>
> Java jonx:
> JDK 5.0 - VM version 1.5.0_03
> Apache Tomcat 5.5.9
> Spring 1.4.1
> Commons DBCP 1.2.1
>
> Hope this helps.
>
> Regards,
> Atif Faridi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]