Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Classloading Question

Brian Munroe

2007-07-31


I am connecting my application to a Oracle XE database and I am having
a weird issue with classloading.

According to the classloading documentation [1] I should be placing
the Oracle JDBC jar file ojdbc14.jar in $CATALINA_HOME/shared/lib, but
when I do that, my application throws a Cannot load JDBC driver class
'oracle.jdbc.OracleDriver' exception.

This also happens if I move the jar file to WEB-INF/lib too.

The only way I can get it to work is to place it in $CATALINA_HOME/common/lib

Any ideas? I've attached my test case and it's the application level
context.xml file

thanks

-- brian

[1] - http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html

=========
index.jsp (well, the important parts)
=========

InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/XEDB");
Connection conn = ds.getConnection();


=========
context.xml
=========

<?xml version="1.0" encoding="UTF-8"?>

<Context>

<Resource name="jdbc/XEDB"
       type="javax.sql.DataSource"
       driverClassName="oracle.jdbc.OracleDriver"
       url="jdbc:oracle:thin:brian/password@(protected)"
       maxActive="8"
/>

</Context>

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.