Actually now that I think about it more that might be the cause of the null
pointer (but
probably not).  In your poolman.xml file have you set the connection limit
to be a hard
limit?  If you timeout on connections (user timeout) is fairly high you
could run out of
connections, and it might return a "null" instead of a connection.

But that's just a guess.  Also, you might was to also turn on logging (debug
level) in
poolman as well so that you can watch the connections getting checked out
and in.

--mikej
-=-----
mike jackson
[EMAIL PROTECTED]

> -----Original Message-----
> From: Luminous Heart [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 19, 2002 8:36 AM
> To: Tomcat Users List
> Subject: Re: It would be great IF somebody answered me, ONCE, for change
> :(
>
>
> Hi Graig,
> Here is my jsp file. I am not sure what might be
> wrong. Although the same error happens in a bigger
> application in a tc cluster of 3 tomcats. Two of these
> tcs fail while one does not get any forwards after
> that.
>
> Please take a look at my code, if you do not mind.
>
> Best regards.
>
> ===================== JSP =====================
> <%@ page import="java.io.*" %>
> <%@ page import="java.util.*" %>
> <%@ page import="java.text.*" %>
>
> <%@ page import="java.util.Properties" %>
> <%@ page import="java.util.Date" %>
>
> <%@ page contentType="text/html"%>
>
> <%@ page import="com.codestudio.util.*"%>
> <%@ page import="java.sql.*"%>
>
> <!-- %@ include file="no-cache.jsp" % -->
>
> <form action="UserAccount.jsp" method=post
> name="access_form">
>   <table width="90%" align="center">
>   <tr>
>               <th bgcolor="#CCCCFF" colspan=3> <font
> size=5>User Access</font></th>
>
>     <td>&nbsp;</td>
>     <td>&nbsp;</td>
>     <td>&nbsp;</td>
>   </tr>
>   <tr>
>     <td>
>         <center>
>           <table cellpadding=4 cellspacing=2 border=0>
>             <th bgcolor="#CCCCFF" colspan=2> <font
> size=5>User Access by userid</font></th>
>             <tr bgcolor="#c8d8f8">
>               <td valign=top colspan=2> <b>User
> Name</b><br>
>                 <input type="text" name="byusername"
> size=25 value=""  maxlength=25>
>               </td>
>             </tr>
>           </table>
> </center>
> </td>
>     <td>
>         <center>
>           <table cellpadding=4 cellspacing=2 border=0>
>             <th bgcolor="#CCCCFF" colspan=2> <font
> size=5>User Access by Date</font><font size=1></font>
>             </th>
>             <tr bgcolor="#c8d8f8">
>               <td valign=top> <b>Date</b><br>
>                 <input type="text" name="bydate"
> value="" size=25  maxlength=125>
>                 <br>
>               </td>
>             </tr>
>           </table>
> </center>
> </td>
>     <td>
>         <center>
>           <table cellpadding=4 cellspacing=2 border=0>
>             <th bgcolor="#CCCCFF" colspan=2> <font
> size=5>USER Access by IP Address</font>
>             </th>
>             <tr bgcolor="#c8d8f8">
>               <td valign=top> <b>IP Address</b><br>
>                 <input type="text" name="byipaddress"
> value="" size=25  maxlength=125>
>                 <br>
>               </td>
>             </tr>
>           </table>
> </center>
> </td>
>   </tr>
>   <tr>
>     <td>&nbsp;</td>
>     <td align="center" bgcolor="#c8d8f8">
>       <input type="submit" value="Submit"
> name="submit">
>     </td>
>     <td>&nbsp;</td>
>   </tr>
> </table>
> </form>
> <%
>       String inUser = null;
>               String inDate = null;
>               String inIPadd = null;
>
>       try{
>          inUser =
> (request.getParameter("byusername")).trim();
>          if (inUser == null) inUser = "";
>          inDate = request.getParameter("bydate").trim();
>          if (inDate == null) inDate = "";
>          inIPadd =
> request.getParameter("byipaddress").trim();
>          if (inIPadd == null) inIPadd = "";
>
>       }catch(NullPointerException npe){
>               out.println("Please choose a query option.");
>
>       }
>
>         PreparedStatement ps = null;
>          /* Log user access count to the system */
>
>     SQLManager thisManager = null;
>     if (thisManager == null)
>       thisManager = SQLManager.getInstance();
>
>     Connection myConn = null;
>
>        if (myConn == null)
>          myConn = thisManager.requestConnection();
>       if (((inUser != null) && !inUser.equals("") ) ||
> ((inDate != null) && !inDate.equals("")) || ((inIPadd
> != null) && !inIPadd.equals("")))
>       {
>
>         java.util.Date today = new java.util.Date();
>         java.sql.Timestamp stamp = new
> java.sql.Timestamp(today.getTime());
>
>         String stampStr = stamp.toString();
>
>         String timeofday =
> stampStr.substring(11,stampStr.length());
>         String date = stampStr.substring(0,11);
>
>         String todayatZero = date + " 00:00:00.0000";
>
>         todayatZero = "2002-08-01 00:00:00.0000";
>
> inDate += " 00:00:00.0000";
>
>       boolean ValueEntered = false;
> if (((inUser != null)&& (inDate != null) && (inIPadd
> != null)) && (!inUser.equals("") && !inDate.equals("")
> && !inIPadd.equals("")) )
> {
> //out.println("all are not empty and not null!");
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where username = ? and useripaddress
> = ? and timestamp >= ? order by timestamp desc");
> ps.setString(1, inUser);
> ps.setString(2, inIPadd);
> ps.setString(3, inDate);
> ValueEntered = true;
>
> }else{
> if ((inUser != null)&&        (!inUser.equals("")))
> {
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where username = ? order by
> timestamp desc");
> ps.setString(1, inUser);
> //out.println("inUser is not empty!");
> ValueEntered = true;
> }else
> if ((inIPadd != null)&& (!inIPadd.equals("") ))
> {
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where useripaddress = ? order by
> timestamp desc");
> ps.setString(1, inIPadd);
> //out.println("inIPadd is not empty!");
> ValueEntered = true;
> }else
> if ((inDate != null)&& (!inDate.equals("") ))
> {
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where timestamp >= ? order by
> timestamp desc");
> ps.setString(1, inDate);
> //out.println("inDate is not empty!");
> ValueEntered = true;
> }else
> if (((inUser != null) && !inUser.equals("")) &&
> ((inIPadd != null) && !inIPadd.equals("")))
> {
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where username = ? and useripaddress
> = ? order by timestamp desc");
> ps.setString(1, inUser);
> ps.setString(2, inIPadd);
> //out.println("inUser & inIPadd are not empty!");
> ValueEntered = true;
>
> }else
>
> if (((inUser != null) && !inUser.equals("")) &&
> ((inDate != null) && !inDate.equals("")))
> {
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where username = ? and timestamp >=
> ? order by timestamp desc");
> ps.setString(1, inUser);
> ps.setString(2, inDate);
> //out.println("inUser & inDate are not empty!");
> ValueEntered = true;
> }else
>
> if (((inIPadd != null) && !inIPadd.equals("")) &&
> ((inDate != null) && !inDate.equals("")))
> {
> ps = myConn.prepareStatement ("select * from
> DataBaseTableName where username = ? and useripaddress
> = ? order by timestamp desc");
> ps.setString(1, inUser);
> ps.setString(2, inIPadd);
> //out.println("inIPadd & inDate are not empty!");
> ValueEntered = true;
> }
>
> }
>       if(ValueEntered)
>       {
>         ValueEntered = false;
>       ResultSet returnedRecord = ps.executeQuery();
>
>
>       String Attempt = "0";
>       String dUser = "";
>       String userIP = "";
>       String timestamper = "";
>       int counter = 0;
>
>       if (returnedRecord.next())
>       {
> %>
>
>       <html>
>       <head>
>       <LINK REL=STYLESHEET HREF="general.css"
> TYPE="text/css">
>       </head>
>       <body>
>               <table align="center" bgcolor=grey width="90%">
>               <tr bgcolor=#8090aa>
> <td width="2%">Number</td>
> <td width="25%">Username</td>
> <td width="25%">IP</td>
> <td width="5%">Logins</td>
> <td width="25%">Stamp</td>
> </tr>
>
> <%}  //end testReturned.
> returnedRecord.previous(); //keep here to make sure
> you reset the cursor!
>
>       boolean isGrey = false;
>       String cellcolor = "#ee00ff";
>       try{
>           while(returnedRecord.next())
>           {
>               dUser = returnedRecord.getString("username");
>               userIP =
> returnedRecord.getString("useripaddress");
>               Attempt =
> returnedRecord.getString("DataBaseTableName");
>               timestamper =
> returnedRecord.getString("timestamp");
>                                       if (counter % 2 == 0)
>                                               cellcolor = "#aaffee";
>                                       else cellcolor = "#aaff80";
>
>                                       counter++;
>                                       %>
>                                       <tr bgcolor ="<%=cellcolor%>">
>                                       <td><%=counter%></td>
>                                       <td><%=dUser%></td>
>                                       <td><%=userIP%></td>
>                                       <td><%=Attempt%></td>
>                                       <td><%=timestamper%></td>
>                                       </tr>
>
>                                       <%
>                                               isGrey = true;
>                               }
>
>       }catch(java.lang.IndexOutOfBoundsException iobe){
>
>       }catch (java.lang.NullPointerException npe){}
>
>
> %>
> </table>
> </body>
> </html>
> <%}
>
>       ps.close();
>   thisManager.returnConnection(myConn);
>
>       /* End Log user access count to the system */
> }%>
>
> ===================== End JSP =================
> --- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Mon, 19 Aug 2002, Luminous Heart wrote:
> >
> > > Date: Mon, 19 Aug 2002 08:14:08 -0700 (PDT)
> > > From: Luminous Heart <[EMAIL PROTECTED]>
> > > Reply-To: Tomcat Users List
> > <[EMAIL PROTECTED]>
> > > To: Tomcat Users List
> > <[EMAIL PROTECTED]>
> > > Subject: It would be great IF somebody answered
> > me, ONCE, for change :(
> > >
> > > I keep on asking this question but noone helps. Is
> > it
> > > a bug in TC?
> > >
> >
> > Since Tomcat doesn't do any database processing of
> > its own, this issue is
> > virtually guaranteed to be a bug in your code, or
> > (much less likely, but
> > possible) a bug in the postgres or poolman packages.
> >  THerefore, asking
> > for help on a Tomcat list isn't likely to be useful
> > -- especially since
> > you don't include any of the code on your page that
> > illustrates what you
> > are trying to do.
> >
> > Craig
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to