You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by peterramesh <ra...@gmail.com> on 2009/02/02 13:06:34 UTC

Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?

Hi,

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).

If I haven't placed in CATALINA_HOME/lib folder, my app is failing with
driver not found error. I'm puzzled with..

1. Why Tomcat look for the JDBC jar to be in CATALINA_HOME/lib folder?
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?

Thanks,
Ramesh
-- 
View this message in context: http://www.nabble.com/Why-tomcat-6.0.18-looks-for-MySQL-JDBC-driver-to-be-placed-in-CATALINA_HOME-lib-folder--tp21788529p21788529.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?

Posted by peterramesh <ra...@gmail.com>.
Hi Gregor,

>Why should your webapps require different versions of the same
>JDBC-driver? Do you have different instance of MySQL running?
>If not, IMHO that doesn't make any sense at all.

Thanks for your reply, this make me understood that Tomcat server just need
a JDBC driver (single version) for a MySQL instance, and it shall support
JNDI datasource for the web apps deployed in that Tomcat instance.

Thanks and Regards,
Ramesh




-- 
View this message in context: http://www.nabble.com/Why-tomcat-6.0.18-looks-for-MySQL-JDBC-driver-to-be-placed-in-CATALINA_HOME-lib-folder--tp21788529p21830995.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?

Posted by Gregor Schneider <rc...@googlemail.com>.
Within the docs I do not see a recommendation to place the JDBC-driver
both in ${CATALIN_HOME}/lib *AND* WEB-INF:

==============

1. Install Your JDBC Driver

Use of the JDBC Data Sources JNDI Resource Factory requires that you
make an appropriate JDBC driver available to both Tomcat internal
classes and to your web application. This is most easily accomplished
by installing the driver's JAR file(s) into the $CATALINA_HOME/lib
directory, which makes the driver available both to the resource
factory and to your application.

===============

> 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?

I'd reconsider my webapps preferabbly:

Why should your webapps require different versions of the same
JDBC-driver? Do you have different instance of MySQL running?
If not, IMHO that doesn't make any sense at all.

Rgds

Gregor
-- 
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371

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


Re: Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?

Posted by peterramesh <ra...@gmail.com>.
Hi Kees,

Yes. Since, I'm using the JNDO datasource the JDBC driver need to be in
$CATALINA_HOME, becase 'common' class loader looks for the JDBC driver (it
may be invoked by tomcat-dbcp.jar).

Ramesh


Kees de Kooter wrote:
> 
> Hi Ramesh,
> 
> Did you configure a JNDI datasource in tomcat? In that case the
> datasource exists "outside" your app.
> 
> Cheers,
> Kees de Kooter
> http://www.boplicity.net
> 
> 
> 
> On Mon, Feb 2, 2009 at 13:06, peterramesh <ra...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> 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).
>>
>> If I haven't placed in CATALINA_HOME/lib folder, my app is failing with
>> driver not found error. I'm puzzled with..
>>
>> 1. Why Tomcat look for the JDBC jar to be in CATALINA_HOME/lib folder?
>> 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?
>>
>> Thanks,
>> Ramesh
>> --
>> View this message in context:
>> http://www.nabble.com/Why-tomcat-6.0.18-looks-for-MySQL-JDBC-driver-to-be-placed-in-CATALINA_HOME-lib-folder--tp21788529p21788529.html
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Why-tomcat-6.0.18-looks-for-MySQL-JDBC-driver-to-be-placed-in-CATALINA_HOME-lib-folder--tp21788529p21830890.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?

Posted by Kees de Kooter <kd...@gmail.com>.
Hi Ramesh,

Did you configure a JNDI datasource in tomcat? In that case the
datasource exists "outside" your app.

Cheers,
Kees de Kooter
http://www.boplicity.net



On Mon, Feb 2, 2009 at 13:06, peterramesh <ra...@gmail.com> wrote:
>
> Hi,
>
> 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).
>
> If I haven't placed in CATALINA_HOME/lib folder, my app is failing with
> driver not found error. I'm puzzled with..
>
> 1. Why Tomcat look for the JDBC jar to be in CATALINA_HOME/lib folder?
> 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?
>
> Thanks,
> Ramesh
> --
> View this message in context: http://www.nabble.com/Why-tomcat-6.0.18-looks-for-MySQL-JDBC-driver-to-be-placed-in-CATALINA_HOME-lib-folder--tp21788529p21788529.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Why tomcat 6.0.18 looks for MySQL JDBC driver to be placed in CATALINA_HOME/lib folder?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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