commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nappin" <>
Subject RE: [DBCP] per-user pooling with Oracle JDBC thin driver
Date Thu, 21 Oct 2004 09:44:40 GMT
Thanks for everyone's advice - I did have the driver down in two
locations - deleting one of these solved the ClassCastException.


-----Original Message-----
From: Dirk Verbeeck [] 
Sent: 20 October 2004 22:01
To: Jakarta Commons Users List
Subject: Re: [DBCP] per-user pooling with Oracle JDBC thin driver

This ClassCastException is a typical Classloader problem.
The oracle.sql.CLOB class has been loaded 2 times by 2 different 

Most likely you have a Oracle driver in common/lib and also one in 
WEB-INF/lib. Delete all driver jars except the one in common/lib.

-- Dirk

Chris Nappin wrote:

> Hi,
>   I've managed to get a little further by adding a
> call after all SELECT queries (we were only committing UPDATEs and
> INSERTs, not reads) which is a nasty workaround but needed since I
> have a read-only data-source.
> However, I'm now getting some *really* odd errors in our Clob-handling
> code:
> java.sql.Clob realClob = rs.getClob(1);
> System.out.println("realClob classname is: " +
> realClob.getClass().getName());
> if (realClob instanceof oracle.sql.CLOB) {
> 	System.out.println("realClob is a oracle.sql.CLOB");
> } else {
> 	System.out.println("realClob is NOT a oracle.sql.CLOB");
> }
> oracle.sql.CLOB clob = (oracle.sql.CLOB) realClob; 
> This code prints out a classname of "oracle.sql.CLOB", but instanceof
> fails and the last line produces a ClassCastException!
> That's really weird and shouldn't be possible in Java (getClass is
> so can't every contradict instanceof)????
> Everything works fine using direct connections though, it's only when
> using DBCP that I get the above error. Does DBCP use wrapped
> and ResultSets? I've tried Oracle JDBC and (buggy
> but matches our dbms version) drivers, both give this error.
> Cheers,
>    Chris Nappin

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message