Re: DBCP Configuration with Tomcat 4.1.27 and mySQL

From: Tom Martin (webmaster_at_sanjamar.com)
Date: 12/31/03


Date: 31 Dec 2003 11:08:22 -0800

dyksjare@hotmail.com (Jared Dykstra) wrote in message news:<ba84b53e.0312292123.268e6623@posting.google.com>...
> webmaster@sanjamar.com (Tom Martin) wrote in message news:<1e5c5944.0312291224.66e34aa@posting.google.com>...
> > I'm a Java Web developer NEWBIE that has inherited a website that
> > fails every 2 hours due to poor connection pooling between Tomcat
> > 4.0.6 and mySQL. In efforts to resolve this problem, I've created
> > another replica DEVELOPMENT website and upgraded it to Tomcat 4.1.27.
>
>
> Well, tomcat is telling you where the program fails:
> java.lang.NullPointerException
> at jsp.sanjamar.test.CatMan.SelectSubCategories(CatMan.java:110)
> at jsp.sanjamar.test.CatMan.ListSubCategories(CatMan.java:54)
>
> Unfortunately, from your previous post, I have no idea what line 110
> of CatMan.java is, nor do I know which line corresponds to #54. Some
> operation is being performed on a NULL object. Look at these two
> lines and the problem will probably become obvious. It's likely a
> logic problem, not a server configuration issue.
>
> ---
> Jared Dykstra
> http://www.bork.org/~jared

Jared,

Thanks for taking the time to even look at this - much appreciated.

Line 54 SelectSubCategories(category);
Line 110 rs = stmt.executeQuery("SELECT name FROM prodtypes "+
Line 111 "WHERE category = '"+MajorCat+"' group by name order by
name;");

I don't get this error on the live site (i.e. Tomcat 4.0.6). Agreed,
from what little I've learned thus far, this doesn't seem DBCP
related. Question: Could I have coded this below snippet incorrectly?
 Thus the con object isn't created successfully, therefore, it can't
pass it (via extends Prop) to the CatMan.class for Line 110 - "stmt".

    //New Code for DBCP
    Connection con = ds.getConnection();
    //Original Code
    //con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/sanjamar",
"xxxxxxxxxx", "xxxxxxxxxxx");

Thoughts?

Thanks in advance