commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [DBCP] getting the underlying result set for Blob processing
Date Tue, 11 Feb 2003 21:14:53 GMT


On Tue, 11 Feb 2003, Stephen Westbom wrote:

> Date: Tue, 11 Feb 2003 12:26:59 -0800 (PST)
> From: Stephen Westbom <swestbom@yahoo.com>
> Reply-To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
> Subject: Re: [DBCP] getting the underlying result set for Blob processing
>
> Helpful class loader info.
>
> The common/lib jar is in the classpath of the system class loader (called after
> the boostrap class loader based on your JVM's classpath).  The WEB-INF/lib has
> an web application specific class loader (this is why applications can be
> independent from each other within a web container).  The WAR's class loader is
> a child node of the parent, the system class loader.
>
> A child class loader such as your WAR uses always defers class loading to the
> parent, if the parent cannot find the class then the child tries on down the
> chain.
>
> If you want the same versions of commons-dbcp and commons-pool to be used
> across all applications within your Tomcat instance put them in common/lib
> otherwise remove them from there and put them in the WEB-INF/lib directory as
> part of your deployment.
>
> There can also be visibility issues between parent and child class loaders.
> The parent class loader will not see child classes if they are not in its class
> path, so a class loaded by a parent object using the parent's class loader may
> try to load a class that only exists in the child class loader's class path and
> not find it.  This is a fairly frequent problem for services.
>
> I hope this helps you understand the way class loaders work in web containers.
> It should help when you run into this type of problem again (believe me you
> will).
>
>                   Class loader hierarchy:
>
>                       boostrap (starts JVM)
>                           |
>                           |
>                        system (classpath entries)
>                          / \
>                         /   \
>                        /     \
>                       webapp  webapp (WEB-INF/lib)
>

In Tomcat the picture is slightly more complicated, because Tomcat
provides a couple of extra layers between system and webapp:

  http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html

but the same principles apply.

>
> --- Kevin HaleBoyes <kzboyes@yahoo.com> wrote:
> > --- "Craig R. McClanahan" <craigmcc@apache.org> wrote:
> > >
> > > Struts 1.1b3 already has the patched version of DelegatingResultSet
> > > in it.
> > > I would put copy both commons-dbcp and commons-pool to make sure
> > > they are
> > > in synch, although I don't anticipate problems.
> >
> > Just to make sure I understand correctly.  Take the commons-dbcp and
> > commons-pool from the Struts 1.1b3 (already in my WEB-INF/lib
> > directory) and copy them to CATALINA_HOME/common/lib.
> >

Yes.  My suggestion is that if update one, update 'em both.

> > Thanks,
> > Kevin.

Craig

Mime
View raw message