Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: MySql Connector returning ?DataSource

Christopher Schultz

2007-07-23

Replies:

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

Chuck,

Caldarale, Charles R wrote:
>> From: Prem Padarath [mailto:ppadarath@(protected)]
>> Subject: Re: MySql Connector returning ?DataSource
>>
>> I checked. The mysql jar file is in common\lib directory!
>
> Is it also in the webapp's WEB-INF/lib directory? Having it in two
> places at once can cause all sorts of interesting problems.

I'll bet this is the problem. It's odd, though, since the exception is:

Caused by: java.lang.ClassCastException:
org.apache.tomcat.dbcp.dbcp.BasicDataSource
 at org.apache.naming.factory.ResourceFactory.getObjectInstance(
ResourceFactory.java:97)

Here's the code in question:

          if (factoryClass != null) {
            try {
// line 97         factory = (ObjectFactory)
// line 97 cont'd           factoryClass.newInstance();
            } catch (Throwable t) {
               if (t instanceof NamingException)
                  throw (NamingException) t;
               NamingException ex = new NamingException
                  ("Could not create resource factory
                  instance");
               ex.initCause(t);
               throw ex;
            }
          }

For some reason, his ObjectFactory isn't an ObjectFactory... it's a
BasicDataSource.

Prem, have you put any Tomcat-related JAR files into your WEB-INF/lib
directory?

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

iD8DBQFGpSrM9CaO5/Lv0PARAoPUAJ0Xl9GGATFzREuXwvl/CFaWjkBSrwCgmuR/
OaZxzNwC6nlnpVIfHn7XSZo=
=eEfQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.