You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Kenny Smith <to...@journalscape.com> on 2003/02/21 08:04:05 UTC

[dbcp] [pool] [jocl] The reason why the DBCP/JOCL example doesn't work.

Hello all,

I finally figured out why DBCP/JOCL was not working for me.

I've been getting an InvocationTargetException while parsing my jocl file,
but the error message never contains where the real problem occurs.

The reason is four fold:

1) The commons-pool package uses the commons-collections, but does not
document that requirement in any of its documentation.

2) The o.a.c.jocl.ConstructorUtil is catching the ClassNotFoundException (as
a generic Exception) and discarding it, then later when a second exception
occurs due to the first one, it throws an InvocationTargetException but
gives no mention that the real cause which was the first
ClassNotFoundException.

3) There is an error in the jocl example:

<object class="org.apache.commons.pool.StackKeyedObjectPoolFactory">

should be

<object class="org.apache.commons.pool.impl.StackKeyedObjectPoolFactory">

4) There is ANOTHER error in the jocl example:

<string value="SELECT COUNT(*) FROM DUAL"/> <;!-- validation query -->

The semi-colon in the comment at the end makes this an invalid XML fragment.

I recommend the following change:

<string value="SELECT COUNT(*) FROM DUAL"/> <!-- oracle validation query -->

or

<string value="SELECT 1"/> <!-- mysql validation query -->


Can someone please update the javadocs and spare other newbies hours of pain
and frustration that most likely will end in not using the package?

Also, can someone add the following ClassNotFoundException block to
o.a.c.jocl.ConstructorUtil around line 92:

} catch(ClassNotFoundException e) {
	e.printStackTrace() ;
	ctor = null;
} catch(Exception e) {
	ctor = null;
}

I'm having issues creating a diff patch or I would include it here. The
above should at least give some info in the specific case that a package
isn't in the class path.

Kenny Smith
JournalScape.com