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

Dhiren,

On 3/9/2010 11:48 AM, Dhiren Bhatia wrote:
> I'm trying to use the commons DBCP package with Tomcat 6.x. I know that the
> tomcat_dbcp.jar has the commons files renamed, however I would prefer to use
> the commons jar files so I can use the class
> org.apache.commons.dbcp.BasicDataSource in my code.

You could also use org.apache.tomcat.dbcp.dbcp.BasicDataSource, which is
the one provided by Tomcat.

> To do this, I deleted the tomcat_dbcp.jar file from CATALINA_HOME/lib and
> replaced it with the commons jar file.

Why would you do that? Tomcat re-packages DBCP under a different package
structure precisely so that you can have both libraries installed at once.

> I assumed that the class loader would
> pick it up like it did in the earlier version of tomcat but that doesn't
> seem to happen. I still get an ClassCastException since tomcat tries to cast
> the org.apache.commons.dbcp.BasicDataSource to
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.

What's crazy is that you didn't get a ClassNotFoundException looking for
org.apache.tomcat.dbcp.dbcp.BasicDataSource.

> Is there any way I can force Tomcat 6.x to load my commons dbcp jar instead
> of the tomcat_dbcp.jar which comes with the distro?

You don't want it to load commons-dbcp.jar /instead of/
tomcat-dbcp.jar... you want it to load both.

But, that won't solve your problem: can you post the code that you use
to use BasicDataSource in your code (including imports)?

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

iEYEARECAAYFAkuWhS0ACgkQ9CaO5/Lv0PCfkQCeOw0+p5poGdFKaOr7WBaSDT3j
p8sAoI/jj5RcasUjo/1oAEAqc4uGid3P
=rneK
-----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