pg.ddx.io  pljava-dev@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Subject: [Pljava-dev] null pointer exception in pl/java jdbc driver
Date: Mon, 14 May 2012 15:16:22 -0400
Message-ID: <C35FDD5FDF7E584991A6AAF8F1A8425F0226AD3A@ltischx01.lti.int> (raw)

i'm having trouble chasing down what may be close to the last bug in my pl/java code, a null pointer when executing an update. are there restrictions on what i can do inside a function with this jdbc driver? at this point, the code has successfully done a select, found the rows it wants and issued an http request to a solr search engine; now it needs to delete the rows that triggered the successful update:

the method:

private static void removeUpdateRecords( Connection conn, String core, List<Integer> ids){
    String idString = idsToString( ids);

    try {
        Statement update = conn.createStatement();
        String updateString = "DELETE FROM solr_index_event WHERE core = '"
                + core + "' AND id IN (" + idString + ")";
        Logger.getLogger(SolrPush.class.getName()).log( Level.INFO, "delete sql: " + updateString);
        update.executeUpdate(updateString);
    } catch (SQLException ex) {
        Logger.getLogger(SolrPush.class.getName()).log(Level.SEVERE, "Failed to remove solr_index_event row, core: " + core + " ids: " + idString, ex);
        throw new IllegalStateException("Failed to remove solr_index_event row core: " + core + " ids: " + idString, ex);
    }
}

here is the logger output (i've verified i have both an update statement and a complete and correct seeming sql update statement -- and yes, com.example in the java package names is deliberate obfuscation my part).


INFO:  14 May 12 19:00:37 com.example.solr.SolrPush delete sql: DELETE FROM solr_index_event WHERE core = 'components' AND id IN (1651, 1652)
ERROR:  14 May 12 19:00:37 com.example.solr.SolrPush Exception in RetryPush
org.postgresql.pljava.internal.ServerException: 14 May 12 19:00:37 com.example.solr.SolrPush SQL Exception in retryPush
org.postgresql.pljava.internal.ServerException: 14 May 12 19:00:37 com.example.solr.SolrPush Failed to remove solr_index_event row, core: components ids: 1651, 1652
org.postgresql.pljava.internal.ServerException: java.lang.NullPointerException
        at org.postgresql.pljava.internal.ExecutionPlan._execute(Native Method)
        at org.postgresql.pljava.internal.ExecutionPlan.execute(ExecutionPlan.java:187)
        at org.postgresql.pljava.jdbc.SPIStatement.executePlan(SPIStatement.java:132)
        at org.postgresql.pljava.jdbc.SPIStatement.execute(SPIStatement.java:108)
        at org.postgresql.pljava.jdbc.SPIStatement.executeUpdate(SPIStatement.java:193)
        at com.example.solr.SolrPush.removeUpdateRecords(SolrPush.java:390)
        at com.example.solr.SolrPush.doUpdates(SolrPush.java:197)
        at com.example.solr.SolrPush.retryPush(SolrPush.java:144)

        at org.postgresql.pljava.internal.Backend._log(Native Method)
        at org.postgresql.pljava.internal.Backend.log(Backend.java:79)
        at org.postgresql.pljava.internal.ELogHandler.publish(ELogHandler.java:100)
        at java.util.logging.Logger.log(Logger.java:498)
        at java.util.logging.Logger.doLog(Logger.java:520)
        at java.util.logging.Logger.log(Logger.java:609)
        at com.example.solr.SolrPush.removeUpdateRecords(SolrPush.java:392)
        at com.example.solr.SolrPush.doUpdates(SolrPush.java:197)
        at com.example.solr.SolrPush.retryPush(SolrPush.java:144)

        at org.postgresql.pljava.internal.Backend._log(Native Method)
        at org.postgresql.pljava.internal.Backend.log(Backend.java:79)
        at org.postgresql.pljava.internal.ELogHandler.publish(ELogHandler.java:100)
        at java.util.logging.Logger.log(Logger.java:498)
        at java.util.logging.Logger.doLog(Logger.java:520)
        at java.util.logging.Logger.log(Logger.java:609)
        at com.example.solr.SolrPush.retryPush(SolrPush.java:170)

gforge=#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20120514/52575ee8/attachment.html;



view thread (11+ messages)  latest in thread

Message-ID: <C35FDD5FDF7E584991A6AAF8F1A8425F0226AD3A@ltischx01.lti.int>
Permalink:  ../C35FDD5FDF7E584991A6AAF8F1A8425F0226AD3A@ltischx01.lti.int/
Also on:    postgresql.org/message-id/C35FDD5FDF7E584991A6AAF8F1A8425F0226AD3A@ltischx01.lti.int

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] null pointer exception in pl/java jdbc driver
  In-Reply-To: <C35FDD5FDF7E584991A6AAF8F1A8425F0226AD3A@ltischx01.lti.int>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox