jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emiliano <emilianoalbi...@tagetik.com>
Subject Re: Question on ConnectionFactory.unwrap() method
Date Fri, 11 Mar 2011 15:02:25 GMT
Hi all,

I am almost facing the same problem Chris wrote about. 
I am using an Oracle9FileSystem and I run into this exception:

Caused by: java.io.IOException: failed to unwrap connection of class org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper,
expected it to be a org.apache.commons.dbcp.DelegatingConnection
	at org.apache.jackrabbit.core.fs.db.DatabaseFileSystem$2.close(DatabaseFileSystem.java:757)
	at org.apache.jackrabbit.core.NamespaceRegistryImpl.store(NamespaceRegistryImpl.java:253)
	... 75 more

The point is that Tomcat - my web container - is using a different class (org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper)
to wrap the real JDBC connection, causing the exception the be thrown.

Am I missing something?


On Mar 7, 2011, at 2:54 PM, Chris Schmidt wrote:

> There is a method in the org.apache.jackrabbit.core.util.db.ConnectionFactory class that
assumes that a Connection instance will be a wrapped/delegate connection from DBCP. We are
providing a pooled datasource to JackRabbit through JNDI and the Connection being sent to
this method is not a wrapped instance (it's a regular Oracle Connection). I looked through
the history and the original connection pooling issue, but don't see a reason why there is
a need for a hard failure on line 206:
>    public static Connection unwrap(Connection con) throws SQLException {
>        if (con instanceof DelegatingConnection) {
>            return ((DelegatingConnection)con).getInnermostDelegate();
>        } else {
>            throw new SQLException("failed to unwrap connection of class " + con.getClass().getName()
>                ", expected it to be a " + DelegatingConnection.class.getName());
>        }
>    }
>  If there are no objections, can this class be modified to return the passed in Connection
if it isn't wrapped? I've changed the code locally and it allows me to work with an Oracle
9i installation where before it failed with the SQLException being thrown above. I can open
an issue and provide the patch for the change.
> Thanks,
>  Chris Schmidt

View raw message