You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jerome Lacoste <je...@coffeebreaks.org> on 2004/07/30 16:19:25 UTC

DBCP in Tomcat 5.0: must deploy some artifacts in /common/lib (classes) ?!

This is question I asked to the tomcat-user list, without a satisfying
answer.

Maybe I will have more luck here...

Summary:

> Jerome Wrote:
>> Q: I've found out that if I don't put the jocl file AND the DB
>> drivers in the $CATALINA_HOME/common/lib/ (classes) directory, the
>> DBCP would fail.

>> Caused by: java.sql.SQLException: Configuration file not found
>>        at org.apache.commons.dbcp.PoolingDriver.getConnectionPool
>> (PoolingDriver.java:132)
>> [...]
>> or
>> Caused by: java.sql.SQLException: No suitable driver
>>     at java.sql.DriverManager.getConnection(DriverManager.java:532)
>> [...]
>> I've tried to put those in the WEB-INF/lib/ (classes) and the
>> shared/lib/ (classes) but none solution worked.
>> 
>> That sounds like a ClassLoader issue to me, but according to the
>> Tomcat 5.0 doc, I am doing the right thing.
>> 
>> Putting them in common/lib is a workaround I can accept now, but 
>> not for long!
Yoav Wrote:
> That's because Tomcat bundles DBCP.  If you want to separate them
> completely, put your copy in WEB-INF/lib, and the bundled copy in
> server/lib, and nothing for DBCP in the common or shared classloader
> repositories.

I still don't get why it doesn't work. 

The Tomcat ClassLoader doc [1] says: "When a request to load a class
from the web application's WebappX class loader is processed, this class
loader will look in the local repositories first, instead of delegating
before looking."

To me that would mean that the ClassLoader that tries to load these
classes is not the web application ClassLoader, otherwise the resources
would be loaded.

But my application seems to be the one that tries to load the
class/resource: the failure to load the resource happens below the web
application's code and not in some special tomcat initialization code.

Is it possible for you (or someone else) to explain me why ?

Jerome

---
The question answer can be found here:
http://marc.theaimsgroup.com/?l=tomcat-user&m=109095682027335&w=2


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org