|
From: Bill H. <bi...@lo...> - 2002-12-04 17:20:31
|
Hi all, Released 0.5 last night. Some last minute changes to do with fatal sql exceptions (it wasn't working). I don't think it caused any knock on effects and all the unit tests worked okay. But I have a cautious, worried feeling at the back of my mind. Please let me know how it behaves. Release 0.6 should happen in a few weeks. It will include some new stuff relating to persistent configurators. The goals now are bug fixes, improved documentation and ease of configuration. Any feedback on the new web site would be good. Bas, I messed around with your "quick start" page a little so that it fitted in with the rest of the doc without too much duplication. Regards, Bill |
|
From: Martin C. <mus...@us...> - 2002-12-04 18:47:41
|
Bill,
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)
I've attached my driver initialisation code incase there is a new
configuration that I missed, although this appears to work alright. The
stack trace shows that my exception occurs when calling
Connection.createStatement(). Perhaps a VM or JDBC version issue? I
downloaded the jar, I have not compiled from sources.
Thanks.
Martin
// Get the init url parameter
String sJdbcUrl= oContext.getInitParameter("JDBC_URL");
String sJdbcDriver = oContext.getInitParameter("JDBC_DRIVER");
String sJdbcPoolMaxConn=
oContext.getInitParameter("JDBC_POOL_MAX_CONNECTIONS");
String sJdbcPoolMinConn=
oContext.getInitParameter("JDBC_POOL_MIN_CONNECTIONS");
String sJdbcPoolTestSql= oContext.getInitParameter("JDBC_POOL_TEST_SQL");
Properties oProperties = new Properties();
oProperties.setProperty("proxool.maximum-connection-count",
sJdbcPoolMaxConn);
oProperties.setProperty("proxool.maximum-new-connections",
sJdbcPoolMinConn);
oProperties.setProperty("proxool.house-keeping-test-sql",
sJdbcPoolTestSql);
m_sJdbcUrl = "proxool:" + sJdbcDriver + ":" + sJdbcUrl;
try {
// Register the connection pool
Class.forName(JDBC_CONNECTION_POOL_DRIVER);
} catch (Exception e) {
throw new SQLException("Cannot find JDBC Connection Pool driver: " +
JDBC_CONNECTION_POOL_DRIVER);
}
try {
// Register the JDBC driver
Class.forName(sJdbcDriver);
} catch (Exception e) {
throw new SQLException("Cannot find JDBC driver: " + sJdbcDriver);
}
Connection oConnection = DriverManager.getConnection(m_sJdbcUrl,
oProperties);
if (oConnection != null) {
m_bInitialised = true;
return(oConnection);
}
throw new SQLException("Unable to initialize JDBC Connection Pool");
|
|
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 |
|
From: Martin C. <mus...@us...> - 2002-12-05 15:14:55
|
Bill, First of all thanks for the detailed response. > > http://proxool.sourceforge.net/download/proxool-cvs-debug.jar > This didn't seem to have the debugging information when I tried it. > (Maybe we should create all the JARs with debug > information in until we get to 1.0...) Maybe just have a debug version available for download. Some people might already be using proxool in production. Or hopefully most people are not as lazy as me and will compile themselves;) > What JDBC driver are you using? https://sourceforge.net/projects/jxdbcon/ (0.9z which is the latest) > > http://proxool.sourceforge.net/download/proxool-crawford.jar > Fixed! If you would like the stack track for more information let me know. Thanks for the speedy fix/response! Martin |
|
From: Bill H. <bi...@lo...> - 2002-12-06 12:00:37
|
Martin, On Thu, 2002-12-05 at 15:25, Martin Crawford wrote: > > http://proxool.sourceforge.net/download/proxool-cvs-debug.jar > > > > This didn't seem to have the debugging information when I tried it. Hmm. I just tried it (downloaded it from that link) and it worked for me. Are you sure you have removed the old jar from your classpath? Just to be absolutely clear, I expect that jar to include line numbers in the stack trace (I'm sure you knew that though :) > > What JDBC driver are you using? > > https://sourceforge.net/projects/jxdbcon/ (0.9z which is the latest) That's useful to know. I might take a peek at the code if we don't get to the bottom of this soon. > Fixed! If you would like the stack track for more information let me know. That's good. We've identified the problem. But not entirely fixed it I'm afraid. As it is, all sub-classes of Statement (like CallableStatement) will not work correctly. There are two options, hack the code to work with all sub-classes too; or try to work out why the original code (which works with other JDBC drivers) doesn't work for jxdbcon. If you can spare a little time I'd like to try and pursue it for a little (and if I fail to work out the root cause then we can add the hack). I've added some debug code to the offending section so that we can see exactly what's going on. Would you mind testing this new jar (which doesn't have the fix in) and letting me know the results? http://proxool.sourceforge.net/download/proxool-CVS.jar You should see some debug output along the lines of: delegateStatement: java.sql.Statement proxiedStatement: java.sql.Statement > Thanks for the speedy fix/response! No problem. Bill |
|
From: Bill H. <bi...@lo...> - 2002-12-06 16:21:29
|
Further to my earlier email: On Fri, 2002-12-06 at 12:02, Bill Horsman wrote: > > > What JDBC driver are you using? > > > > https://sourceforge.net/projects/jxdbcon/ (0.9z which is the latest) > > That's useful to know. I might take a peek at the code if we don't get > to the bottom of this soon. I've taken a look at the code and I see the problem. Their Statement implementation doesn't implement Statement directly but extends an abstract class that does so. This exposes a limitation in Proxool's code that I have now fixed. The latest CVS copy should now work for jxDBCon driver using methods to create Statements, PreparedStatements and CallableStatements. For your convenience I have I built a JAR: http://proxool.sourceforge.net/download/proxool-CVS.jar > If you > can spare a little time I'd like to try and pursue it for a little (and > if I fail to work out the root cause then we can add the hack). I've > added some debug code to the offending section so that we can see > exactly what's going on. Would you mind testing this new jar (which > doesn't have the fix in) and letting me know the results? Don't bother with that now. Just let me know whether the new version fixes it for you. I suspect it will. Since nobody else has reported this problem I probably won't bother making a new release early. 0.6 is scheduled for round about December 12. Regards, Bill |
|
From: Martin C. <mus...@us...> - 2002-12-06 20:51:29
|
Bill, > I've taken a look at the code and I see the problem. Their Statement > implementation doesn't implement Statement directly but extends an > abstract class that does so. This exposes a limitation in Proxool's code > that I have now fixed. The latest CVS copy should now work for jxDBCon > driver using methods to create Statements, PreparedStatements and > CallableStatements. Right, this is the whole concept for the jxDBCon framework. I guess not many drivers make use of abstraction? I find this driver to be a better/cleaner implementation for PostgreSQL than the one that actually ships with the database. > For your convenience I have I built a JAR: > > http://proxool.sourceforge.net/download/proxool-CVS.jar Again thanks for providing binaries. I feel lazy;) I think it's time I get a copy and compile myself from source. > Don't bother with that now. Just let me know whether the new version > fixes it for you. I suspect it will. Sorry it didn't. Here is the stack trace: Caused by: java.lang.RuntimeException: Unexpected invocation exception: $Proxy2 at org.logicalcobwebs.proxool.ProxyConnection.invoke(ProxyConnection.java:114) at $Proxy1.createStatement(Unknown Source) > Since nobody else has reported this problem I probably won't bother > making a new release early. 0.6 is scheduled for round about December > 12. I'm in not hurry to upgrade 0.4 works perfectly fine for me. But, I am happy to help test this one. I was easily able to build from source so we can begin the debugging mayhem! My company is actively developing a servlet application using proxool, so it's very easy for me to drop in a new version during the development cycle. Again 0.4 works perfect for us so we're in no panic. Perhaps you could share the differences between the 0.4 code and 0.5 code that would "break" abstraction of a Statement interface? Just for those curious... Thanks again for being so helpful. Martin |
|
From: Bill H. <bi...@lo...> - 2002-12-08 22:35:02
|
Hi Martin,
On Fri, 2002-12-06 at 21:02, Martin Crawford wrote:
> Sorry it didn't. Here is the stack trace:
>
> Caused by: java.lang.RuntimeException: Unexpected invocation exception:
> $Proxy2
> at
> org.logicalcobwebs.proxool.ProxyConnection.invoke(ProxyConnection.java:114)
> at $Proxy1.createStatement(Unknown Source)
>
> > Since nobody else has reported this problem I probably won't bother
> > making a new release early. 0.6 is scheduled for round about December
> > 12.
If you look at the following two lines:
LOG.error("Unexpected invocation exception", e);
throw new RuntimeException("Unexpected invocation exception: " +
e.getMessage());
The first one logs the trace of the original exception. The second one
throws a new exception to the user [of Proxool].
What I'm really interested in is the trace from the first one. And
you'll see that in the Proxool log. If you haven't cofigured that at all
it will be in stdout. If you've configured Logging at all (with, for
instance, Log4J) then it will be wherever you said it would be :)
> Perhaps you could share the differences between the 0.4 code and 0.5 code
> that would "break" abstraction of a Statement interface? Just for those
> curious...
In 0.5 we started proxying the Statement as well as the Connection. This
allows us to have better control over the behaviour of the Statement.
Like logging execution traces and times. And trapping SQLExceptions that
might prove fatal (to the Connection).
I've also just committed the code to add more debug to this problem. I
was pretty confident I'd fixed it so I'm now intrigued. Perhaps it is a
second problem appearing. But it's not very complicated so I'm sure we
can nail it. If I get time tomorrow I'll try and setup a jxDBCon test
environment. That would speed things along.
The binary is in the usual place:
http://proxool.sourceforge.net/download/proxool-CVS.jar
It is quick for me to build binaries but it does add a layer of doubt to
bug fixing. If either one of us fails to copy the jar to the right place
then it would be easy for us to be testing the wrong version.
(On that note, I'm going to add a line to the log that shows what
version is being run.)
Regards,
Bill
|
|
From: Bas C. <ba...@ci...> - 2002-12-06 19:14:43
|
Bill Horsman wrote:
> Since nobody else has reported this problem I probably won't bother
> making a new release early. 0.6 is scheduled for round about December
> 12.
Wait! We have a request for 0.6: J2EE compliant drivers are not allowed
to access System properties. Could you replace the following code?
proxool-0.5\src\java\org\logicalcobwebs\proxool\ReloadMonitor.java/64:
System.setProperty(LOAD_TIME_PROPERTY,
String.valueOf(System.currentTimeMillis()));
----------------------------------------
proxool-0.5\src\java\org\logicalcobwebs\proxool\ReloadMonitor.java/92:
return Long.parseLong(System.getProperty(LOAD_TIME_PROPERTY));
BTW: The exception that was thrown during the J2EE 1.3.1 CTS tests was
caused by JDBC 3.0 API calls. We'll now test with the 1.2.1 CTS, which
tests against the JDBC 2.0 API. Please expect our results early next week.
Kind regards,
Bas
--
Bas Cancrinus -> ba...@ci...
Software Architect
Cipherware Ltd. -> http://www.cipherware.com
|
|
From: Bill H. <bi...@lo...> - 2002-12-08 22:07:28
|
Hi Bas, > Wait! We have a request for 0.6: J2EE compliant drivers are not allowed > to access System properties. Could you replace the following code? > > proxool-0.5\src\java\org\logicalcobwebs\proxool\ReloadMonitor.java/64: > System.setProperty(LOAD_TIME_PROPERTY, > String.valueOf(System.currentTimeMillis())); > ---------------------------------------- > proxool-0.5\src\java\org\logicalcobwebs\proxool\ReloadMonitor.java/92: > return Long.parseLong(System.getProperty(LOAD_TIME_PROPERTY)); We have plenty of time to include that in 0.6. If I can just work out what I'm going to replace it with... I'll have an experiment. Thanks for spotting that uncompliance. It would be good to say that we are fully compliant. > BTW: The exception that was thrown during the J2EE 1.3.1 CTS tests was > caused by JDBC 3.0 API calls. We'll now test with the 1.2.1 CTS, which > tests against the JDBC 2.0 API. Please expect our results early next week. Great. Regards, Bill |