-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 6/25/2010 6:01 PM, Caldarale, Charles R wrote:
>> From: Pid [mailto:p...@pidster.com]
>> Subject: Re: Self-Contained Web Applications
>>
>> We can define a DataSource inside a Context already, hook up a locally
>> configured Realm, and it'll use a driver from the web app ClassLoader,
>> which makes the app completely self contained.
>>
>> I don't understand what Chris is getting at.  :s
> 
> What I interpreted his posting to mean was he wanted
> container-managed connection pooling (and all other JNDI-based
> resource usage) done without placing any classes in any global
> directory space.

Exactly.

> In other words, the Tomcat classes would use the
> webapp's classloader first before looking in any global locations for
> necessary driver libraries.  This might require having the webapp
> classloader get its own copies of the Tomcat classes, but it sounds
> doable with a bit of re-plumbing.

Today, the install process for a webapp that needs MySQL connections is:

1a. Copy mysql-connector-j.x.y.z.jar into CATALINA_BASE/lib
1b. Make sure you don't have mysql-connector-j.x.y.z.jar in WEB-INF/lib
2. Configure DataSource in META-INF/context.xml
3. Use JNDI to locate and use the DataSource

I'm trying to replace step #1 with:

1. Just but mysql-connector-j.x.y.z.jar into WEB-INF/lib

This would alleviate several irritating issues:

1. People always do what I want to do anyway, and want to know why they
get that weird "Cannot load JDBC driver 'null'" message

2. The webapp is not self-contained if it requires MySQL and yet does
not include the MySQL JDBC driver library

3. All webapps (that want to use container-provided DataSource services)
are forced to use the same version of the MySQL driver

4. The DataSource currently outlives the Context, which is kind of silly
if the context itself defines the DataSource

Is there an architectural reason why Tomcat has historically done JNDI
DataSources in this way? Is it because of the historical use of "global"
resources defined in server.xml?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxGSMQACgkQ9CaO5/Lv0PCXaQCgsI6mGrHyY+UmH/q7PUO7T4lR
c9sAoJTlaBZIfeC4k1AYDb0hO3dx3ZyF
=XPWU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to