Error in servlet - Mailing list pgsql-general

From Andreas Tille
Subject Error in servlet
Date
Msg-id Pine.LNX.4.21.0009141702270.546-100000@wr-linux02.rki.de
Whole thread Raw
Responses RE: Error in servlet
List pgsql-general
Hello,

is there any known reason for the following behaviour:

I wrote a servlet with several database accesses via stored functions
and select statements.  On a certain point of my servlet I get
the following:

[14/09/2000 16:31:51:216 CEST] Runtime.log: org.postgresql.jdbc1.ResultSet@80ab4ff
[14/09/2000 16:31:51:217 CEST] java.lang.NullPointerException:
    at org.postgresql.jdbc1.ResultSet.getString(ResultSet.java)
    at WebSQL.pGetGroupMemberByLocation(WebSQL.java:484)
    at Web.DoWeb(Web.java:272)
    at ehec.service(ehec.java:24)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:311)
    at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
    at org.apache.jserv.JServConnection.run(JServConnection.java:188)
    at java.lang.Thread.run(Thread.java)

I try to give a short description of the critical function in WebSQL.java:484

 -----  snip   ----

  public boolean pGetGroupMemberByLocation(Webdata data, int IdStandort,
                              String S_IdArbeitsgruppe, String S_IdMitarbeiter)
  {
    try {
      query = "SELECT * FROM Mitarbeiter; " ;
      query = "SELECT count(*) As FName FROM standort; " ;

      query = "SELECT '<td class=\"MenuMain\"><a class=\"MenuMain\" href=\"' || '" +
              project.GetServletName()  + "' || '?" + "mid" +
              "=' || i.IdMenuShow || '&" + "tid" +
              "=' || i.IdWebSeite || '\">' || i.MenuItem || '</a></td>' " +
              "AS getmenu FROM   Menu m " +
              "INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu  WHERE  m.IdMenu = " + "54" +
          " ORDER BY i.Sort ; " ;
      rs = stmt.executeQuery(query);

if ( rs == null ) error.Common("Write message to logfile");
else error.Common("rs = " + rs); // This is the entry in Runtime.log
query = rs.getString(1);
error.Common("Are you living?");

 ----  snip ----

I tried different querys (see the strings "query").  First I reduced to
simple ones, later I used a more complex which worked inside the same
servlet some statements before and worked.  They show all the same
behaviour to fail with the NullPointerException.

I'm using PostgreSQL 7.0.2, Apache, Jserv.
The behaviour is the same using

  http://www.retep.org.uk/postgres/jdbc7.0-1.1.jar
  http://www.retep.org.uk/postgres/jdbc7.0-1.2.jar

as JDBC driver.

I'm really in desperation with this stupid problem and tried
two days to solve it but failed.  Any idea what might went wrong
here.  It is a problems of threads od anything else.  I can't see
any pointer which could be null here.

Really hoping for your help

           Andreas.


pgsql-general by date:

Previous
From: Hernan
Date:
Subject: testing...(ignore)
Next
From: "Bryan White"
Date:
Subject: Corrupt Table