tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?
Date Thu, 05 Feb 2009 22:42:24 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ramesh,

peterramesh wrote:
> On reading Tomcat help doc 
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html, it
> recommends to place the MySQL  JDBC driver in both places (CATALINA_HOME/lib
> and WEB-INF/lib folder of the app).

I don't think so. The only place on that page where WEB-INF/lib is
referenced is here (as "application's lib folder"):

"
Note: placing these jars in both $CATALINA_HOME/lib and a web
application's lib folder will cause an error, so ensure you have them in
the $CATALINA_HOME/lib location only.
"

Putting your JDBC driver in both place is a recipe for pain.

> 1. Why Tomcat look for the JDBC jar to be in CATALINA_HOME/lib folder?

Tomcat creates the JNDI DataSource and loads your driver outside of the
webapp's ClassLoader. I'm not sure why it does this, but it does. That
requires you to make your driver available to Tomcat in CATALINA_HOME/lib.

> 2. If I copied more than one JDBC jars (with different version) in
> CATALINA_HOME/lib folder for couple of my applications, how each of them
> looks for the respective versions of JDBC driver?

They can't. It'll be completely random which version of the driver
"wins". If you /need/ different JDBC driver versions for the same
database, then you are better off with separate Tomcat instances.

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

iEYEARECAAYFAkmLa08ACgkQ9CaO5/Lv0PBFYwCfQOFXsDx64Vfpv/2W8nd+cF4N
zqsAnjVkrMEclBYZ0uZRxRpLjthoL1QE
=WQ7/
-----END PGP SIGNATURE-----

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


Mime
View raw message