Обсуждение: URGENT: Help with exception

Поиск
Список
Период
Сортировка

URGENT: Help with exception

От
"David Hooker"
Дата:
Hi all-

I'm seeing an un-explainable exception.  I've been trying to track this
down for 4 days with no results.  The exception I see is:

java.lang.NullPointerException

        at
org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:61)
        at org.postgresql.Connection.ExecSQL(Connection.java:398)

        at org.postgresql.jdbc2.Statement.execute(Statement.java:130)

        (... More stuff ...)


My code looks like this:
            String sql = "INSERT INTO " + tableName + " values('" + name
+ "', '" + context +
                        "', '" + docFile.toURI().toString() +
                         "', '" + event.getBoundary() + "', '" +
System.currentTimeMillis() + "', false);";
            logger.finest("SQL: " + sql);
            Statement stmt = conn.createStatement();
            stmt.execute(sql);
            stmt.close();

The string that is logged looks like this:
SQL: INSERT INTO lfs_mappings values('1587313:4', 'Delivery',
'file:/home/dhooker/andrew/tests/btradeTrial/bin/DeliveryDocs/LFS57787.D
AT', '"----=_Part_1_14115383.1035227913496"', '1035227913542', false);


There are no error messages on the backend when I run it with -d 3 or -d
4.

I'm using PostgreSQL 7.1.3 as the server, and the latest pgjdbc2.jar
file from the website downloads area.  I'm running Java:
  java version "1.4.0"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
  Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)

...on RedHat Linux 7.2, kernel 2.4.7-10.

ANY and ALL insight, tips, hints, and guesses are appreciated!!!

Also, if someone can tell me how to get the source code that corresponds
to the jar file, that would be nice.  Thanks.

- David Hooker -
- Sr. Software Architect -
- A4 Networks Corp. -
- dhooker at a4networks.com -



Re: URGENT: Help with exception

От
Jean-Luc Lachance
Дата:
Maybe QueryExecutor is barfing at the double quote...
What is the table definition?


David Hooker wrote:
>
> Hi all-
>
> I'm seeing an un-explainable exception.  I've been trying to track this
> down for 4 days with no results.  The exception I see is:
>
> java.lang.NullPointerException
>
>         at
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:61)
>         at org.postgresql.Connection.ExecSQL(Connection.java:398)
>
>         at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
>
>         (... More stuff ...)
>
> My code looks like this:
>             String sql = "INSERT INTO " + tableName + " values('" + name
> + "', '" + context +
>                         "', '" + docFile.toURI().toString() +
>                          "', '" + event.getBoundary() + "', '" +
> System.currentTimeMillis() + "', false);";
>             logger.finest("SQL: " + sql);
>             Statement stmt = conn.createStatement();
>             stmt.execute(sql);
>             stmt.close();
>
> The string that is logged looks like this:
> SQL: INSERT INTO lfs_mappings values('1587313:4', 'Delivery',
> 'file:/home/dhooker/andrew/tests/btradeTrial/bin/DeliveryDocs/LFS57787.D
> AT', '"----=_Part_1_14115383.1035227913496"', '1035227913542', false);
>
> There are no error messages on the backend when I run it with -d 3 or -d
> 4.
>
> I'm using PostgreSQL 7.1.3 as the server, and the latest pgjdbc2.jar
> file from the website downloads area.  I'm running Java:
>   java version "1.4.0"
>   Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
>   Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)
>
> ...on RedHat Linux 7.2, kernel 2.4.7-10.
>
> ANY and ALL insight, tips, hints, and guesses are appreciated!!!
>
> Also, if someone can tell me how to get the source code that corresponds
> to the jar file, that would be nice.  Thanks.
>
> - David Hooker -
> - Sr. Software Architect -
> - A4 Networks Corp. -
> - dhooker at a4networks.com -
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

Re: URGENT: Help with exception

От
"David Hooker"
Дата:
 stmt.execute("Create table "+ tableName +
              "(name text not null, context text not null, filename text
not null, boundary text, " +
              "insertion_time bigint not null, can_purge boolean,
PRIMARY KEY (name, context));");

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jean-Luc Lachance
Sent: Monday, October 21, 2002 3:54 PM
To: David Hooker
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] URGENT: Help with exception


Maybe QueryExecutor is barfing at the double quote...
What is the table definition?


David Hooker wrote:
>
> Hi all-
>
> I'm seeing an un-explainable exception.  I've been trying to track
this
> down for 4 days with no results.  The exception I see is:
>
> java.lang.NullPointerException
>
>         at
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:61)
>         at org.postgresql.Connection.ExecSQL(Connection.java:398)
>
>         at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
>
>         (... More stuff ...)
>
> My code looks like this:
>             String sql = "INSERT INTO " + tableName + " values('" +
name
> + "', '" + context +
>                         "', '" + docFile.toURI().toString() +
>                          "', '" + event.getBoundary() + "', '" +
> System.currentTimeMillis() + "', false);";
>             logger.finest("SQL: " + sql);
>             Statement stmt = conn.createStatement();
>             stmt.execute(sql);
>             stmt.close();
>
> The string that is logged looks like this:
> SQL: INSERT INTO lfs_mappings values('1587313:4', 'Delivery',
>
'file:/home/dhooker/andrew/tests/btradeTrial/bin/DeliveryDocs/LFS57787.D
> AT', '"----=_Part_1_14115383.1035227913496"', '1035227913542', false);
>
> There are no error messages on the backend when I run it with -d 3 or
-d
> 4.
>
> I'm using PostgreSQL 7.1.3 as the server, and the latest pgjdbc2.jar
> file from the website downloads area.  I'm running Java:
>   java version "1.4.0"
>   Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
>   Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)
>
> ...on RedHat Linux 7.2, kernel 2.4.7-10.
>
> ANY and ALL insight, tips, hints, and guesses are appreciated!!!
>
> Also, if someone can tell me how to get the source code that
corresponds
> to the jar file, that would be nice.  Thanks.
>
> - David Hooker -
> - Sr. Software Architect -
> - A4 Networks Corp. -
> - dhooker at a4networks.com -
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Re: URGENT: Help with exception

От
Jean-Luc Lachance
Дата:
Which jdbc version?
If 7.2.1, looks like the connection has been closed or garbage
collected...


David Hooker wrote:
>
>  stmt.execute("Create table "+ tableName +
>               "(name text not null, context text not null, filename text
> not null, boundary text, " +
>               "insertion_time bigint not null, can_purge boolean,
> PRIMARY KEY (name, context));");
>
> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jean-Luc Lachance
> Sent: Monday, October 21, 2002 3:54 PM
> To: David Hooker
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] URGENT: Help with exception
>
> Maybe QueryExecutor is barfing at the double quote...
> What is the table definition?
>
> David Hooker wrote:
> >
> > Hi all-
> >
> > I'm seeing an un-explainable exception.  I've been trying to track
> this
> > down for 4 days with no results.  The exception I see is:
> >
> > java.lang.NullPointerException
> >
> >         at
> > org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:61)
> >         at org.postgresql.Connection.ExecSQL(Connection.java:398)
> >
> >         at org.postgresql.jdbc2.Statement.execute(Statement.java:130)
> >
> >         (... More stuff ...)
> >
> > My code looks like this:
> >             String sql = "INSERT INTO " + tableName + " values('" +
> name
> > + "', '" + context +
> >                         "', '" + docFile.toURI().toString() +
> >                          "', '" + event.getBoundary() + "', '" +
> > System.currentTimeMillis() + "', false);";
> >             logger.finest("SQL: " + sql);
> >             Statement stmt = conn.createStatement();
> >             stmt.execute(sql);
> >             stmt.close();
> >
> > The string that is logged looks like this:
> > SQL: INSERT INTO lfs_mappings values('1587313:4', 'Delivery',
> >
> 'file:/home/dhooker/andrew/tests/btradeTrial/bin/DeliveryDocs/LFS57787.D
> > AT', '"----=_Part_1_14115383.1035227913496"', '1035227913542', false);
> >
> > There are no error messages on the backend when I run it with -d 3 or
> -d
> > 4.
> >
> > I'm using PostgreSQL 7.1.3 as the server, and the latest pgjdbc2.jar
> > file from the website downloads area.  I'm running Java:
> >   java version "1.4.0"
> >   Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
> >   Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)
> >
> > ...on RedHat Linux 7.2, kernel 2.4.7-10.
> >
> > ANY and ALL insight, tips, hints, and guesses are appreciated!!!
> >
> > Also, if someone can tell me how to get the source code that
> corresponds
> > to the jar file, that would be nice.  Thanks.
> >
> > - David Hooker -
> > - Sr. Software Architect -
> > - A4 Networks Corp. -
> > - dhooker at a4networks.com -
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Re: URGENT: Help with exception

От
"David Hooker"
Дата:
Solved.  Indeed, the connection had been previously closed by code in
another thread.

Which begs the question: why wasn't a more descriptive exception thrown
when trying to use a closed connection?  A null-pointer exception from
the bowels of the driver really didn't give me much of a clue.  Why not
have a ConnectionClosedException or something?

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jean-Luc Lachance
Sent: Monday, October 21, 2002 4:43 PM
To: David Hooker
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] URGENT: Help with exception


Which jdbc version?
If 7.2.1, looks like the connection has been closed or garbage
collected...


David Hooker wrote:
>
>  stmt.execute("Create table "+ tableName +
>               "(name text not null, context text not null, filename
text
> not null, boundary text, " +
>               "insertion_time bigint not null, can_purge boolean,
> PRIMARY KEY (name, context));");
>
> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Jean-Luc
Lachance
> Sent: Monday, October 21, 2002 3:54 PM
> To: David Hooker
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] URGENT: Help with exception
>
> Maybe QueryExecutor is barfing at the double quote...
> What is the table definition?
>
> David Hooker wrote:
> >
> > Hi all-
> >
> > I'm seeing an un-explainable exception.  I've been trying to track
> this
> > down for 4 days with no results.  The exception I see is:
> >
> > java.lang.NullPointerException
> >
> >         at
> > org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:61)
> >         at org.postgresql.Connection.ExecSQL(Connection.java:398)
> >
> >         at
org.postgresql.jdbc2.Statement.execute(Statement.java:130)
> >
> >         (... More stuff ...)
> >
> > My code looks like this:
> >             String sql = "INSERT INTO " + tableName + " values('" +
> name
> > + "', '" + context +
> >                         "', '" + docFile.toURI().toString() +
> >                          "', '" + event.getBoundary() + "', '" +
> > System.currentTimeMillis() + "', false);";
> >             logger.finest("SQL: " + sql);
> >             Statement stmt = conn.createStatement();
> >             stmt.execute(sql);
> >             stmt.close();
> >
> > The string that is logged looks like this:
> > SQL: INSERT INTO lfs_mappings values('1587313:4', 'Delivery',
> >
>
'file:/home/dhooker/andrew/tests/btradeTrial/bin/DeliveryDocs/LFS57787.D
> > AT', '"----=_Part_1_14115383.1035227913496"', '1035227913542',
false);
> >
> > There are no error messages on the backend when I run it with -d 3
or
> -d
> > 4.
> >
> > I'm using PostgreSQL 7.1.3 as the server, and the latest pgjdbc2.jar
> > file from the website downloads area.  I'm running Java:
> >   java version "1.4.0"
> >   Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
> >   Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)
> >
> > ...on RedHat Linux 7.2, kernel 2.4.7-10.
> >
> > ANY and ALL insight, tips, hints, and guesses are appreciated!!!
> >
> > Also, if someone can tell me how to get the source code that
> corresponds
> > to the jar file, that would be nice.  Thanks.
> >
> > - David Hooker -
> > - Sr. Software Architect -
> > - A4 Networks Corp. -
> > - dhooker at a4networks.com -
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org