|
From: Bill H. <bi...@lo...> - 2002-12-05 00:35:00
|
Hi Martin, On Wed, 2002-12-04 at 18:58, Martin Crawford wrote: > Just upgraded to proxool-0.5 on a webapp using tomcat 4.0. I'm using the Sun > Java SDK 1.4.0. > > Everything worked fine with proxool-0.4, but the upgrade throws the > following exception: > > java.lang.ClassCastException: $Proxy2 > at $Proxy1.createStatement(Unknown Source) Knowing the line that it occurred on would be really handy. Would you mind picking up this jar file that is compiled with debug information: http://proxool.sourceforge.net/download/proxool-cvs-debug.jar Or, failing that, compile from source. Then I will know what line is causing the problem. (Maybe we should create all the JARs with debug information in until we get to 1.0...) > I've attached my driver initialisation code Which looks fine. > The stack trace shows that my exception occurs when calling > Connection.createStatement(). The createStatement method is called a lot during our unit tests (as you'd expect) and it seems to work fine. > Perhaps a VM or JDBC version issue? I think the VM should be okay. What JDBC driver are you using? > try { > // Register the JDBC driver > Class.forName(sJdbcDriver); > } catch (Exception e) { > throw new SQLException("Cannot find JDBC driver: " + sJdbcDriver); > } For what it's worth, Proxool registers the delegate JDBC driver for you. But it doesn't do any harm to do it twice. --- I've had a quick review of the code that could be responsible and I have tried doing the creation of the Statement proxy a slightly different way: diff -r1.5 ProxyFactory.java 54c54,55 < return Proxy.newProxyInstance(delegate.getClass().getClassLoader(), delegate.getClass().getInterfaces(), new ProxyStatement(delegate, connectionPool, proxyConnection, sqlStatement)); --- > Class[] interfaces = {Statement.class}; > return Proxy.newProxyInstance(delegate.getClass().getClassLoader(), interfaces, new ProxyStatement(delegate, connectionPool, proxyConnection, sqlStatement)); I have built another JAR that includes that experimental fix: http://proxool.sourceforge.net/download/proxool-crawford.jar Let me know if that fixes it. Or if it doesn't, the full stack trace for the ClassCastException. Regards, Bill |