tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: What is the best way to view Tomcat JDBC pool properties in Tomcat 6?
Date Thu, 08 Mar 2012 15:12:14 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan,

So, ConnectionPool.getProxyConstructor definitely makes a decision
about what interfaces to expose when generating a proxy for a
PooledConnection (sorry for the word-wrapping):

    public Constructor<?> getProxyConstructor(boolean xa) throws
NoSuchMethodException {
        //cache the constructor
        if (proxyClassConstructor == null ) {
            Class<?> proxyClass = xa ?

Proxy.getProxyClass(ConnectionPool.class.getClassLoader(), new Class[]
{java.sql.Connection.class,javax.sql.PooledConnection.class,
javax.sql.XAConnection.class}) :

Proxy.getProxyClass(ConnectionPool.class.getClassLoader(), new Class[]
{java.sql.Connection.class,javax.sql.PooledConnection.class});
            proxyClassConstructor = proxyClass.getConstructor(new
Class[] { InvocationHandler.class });
        }
        return proxyClassConstructor;
    }

This error:

On 3/8/12 9:53 AM, Christopher Schultz wrote:
> 
>> Caused by: java.lang.ClassCastException: $Proxy5 cannot be cast
>> to org.apache.tomcat.jdbc.pool.PooledConnection at 
>> org.apache.tomcat.jdbc.pool.DataSourceProxy.getPooledConnection(DataSourceProxy.java:156)
>>
>> 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at

... looks like it's probably a bug somewhere. I checked the code in
trunk, and nowhere does DataSourceProxy cast anything to
org.apache.tomcat.jdbc.pool.PooledConnection. What version of Tomcat 7
are you using?

It looks like the DataSource must be configured with XA connections
enabled, so this error:

>> Caused by: java.sql.SQLException: Connection from pool does not 
>> implement javax.sql.XAConnection at 
>> org.apache.tomcat.jdbc.pool.DataSourceProxy.getXAConnection(DataSourceProxy.java:134)

...is
>> 
probably due to a misconfiguration. Please double-check that you
have XA enabled in your DataSource.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9YzE4ACgkQ9CaO5/Lv0PDpIwCeOtDG372WawwiuXRT7HF8c1bT
O7oAoIzfybIR2wiomopF/bTm8fVY7T3y
=oDvs
-----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