Thread: ...

...

From
ebeard@lexmark.com
Date:

I've included the information that I think may be helpful.  If you need anything
else, please let me know.

Thanks
     Eric

System Information
NT 4.0   SP 6
Sun's JDK 1.4
pgjdbc2.jar
ODBC drivers 7.02.0001 dated 4/15/02

Source Code

Class.forName("org.postgresql.Driver");
            System.out.println("Driver loaded");
            Connection con = DriverManager.getConnection

("jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432","db","pw");
            System.out.println("Connection made loaded");

            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM ArchiveLogEntry");
            System.out.println("Result queried");

Trace

Something unusual has occured to cause the driver to fail. Please report this
exception: Exception: java.lang.NullPointerException
Stack Trace:

java.lang.NullPointerException
     at org.postgresql.Connection.openConnection(Connection.java:155)
     at org.postgresql.Driver.connect(Driver.java:149)
     at java.sql.DriverManager.getConnection(DriverManager.java:512)
     at java.sql.DriverManager.getConnection(DriverManager.java:171)
     at com.lexmark.printer.fglib.vulog.actionPerformed(vulog.java:201)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
     at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)

     at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
     at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:258)

     at java.awt.Component.processMouseEvent(Component.java:5021)
     at java.awt.Component.processEvent(Component.java:4818)
     at java.awt.Container.processEvent(Container.java:1380)
     at java.awt.Component.dispatchEventImpl(Component.java:3526)
     at java.awt.Container.dispatchEventImpl(Container.java:1437)
     at java.awt.Component.dispatchEvent(Component.java:3367)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
     at java.awt.Container.dispatchEventImpl(Container.java:1423)
     at java.awt.Window.dispatchEventImpl(Window.java:1566)
     at java.awt.Component.dispatchEvent(Component.java:3367)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
     at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)

     at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)

     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
End of Stack Trace



Re:

From
"Nick Fankhauser"
Date:
Eric-


>             System.out.println("Driver loaded");
>             Connection con = DriverManager.getConnection
>
> ("jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432","db","pw");


It looks like you haven't specified a database in the URL. I would expect to
see a URL that looks more like this:

jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432/database-name
                                                           ^^^^^^^^^^^

Regards,

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/


Re:

From
Dave Cramer
Date:
Eric,

This isn't much to go on, can you do me a favour and try the latest
driver from jdbc.postgresql.org and see if you get the same error

Dave
On Tue, 2002-06-04 at 14:38, ebeard@lexmark.com wrote:
>
>
> I've included the information that I think may be helpful.  If you need anything
> else, please let me know.
>
> Thanks
>      Eric
>
> System Information
> NT 4.0   SP 6
> Sun's JDK 1.4
> pgjdbc2.jar
> ODBC drivers 7.02.0001 dated 4/15/02
>
> Source Code
>
> Class.forName("org.postgresql.Driver");
>             System.out.println("Driver loaded");
>             Connection con = DriverManager.getConnection
>
> ("jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432","db","pw");
>             System.out.println("Connection made loaded");
>
>             Statement stmt = con.createStatement();
>             ResultSet rs = stmt.executeQuery("SELECT * FROM ArchiveLogEntry");
>             System.out.println("Result queried");
>
> Trace
>
> Something unusual has occured to cause the driver to fail. Please report this
> exception: Exception: java.lang.NullPointerException
> Stack Trace:
>
> java.lang.NullPointerException
>      at org.postgresql.Connection.openConnection(Connection.java:155)
>      at org.postgresql.Driver.connect(Driver.java:149)
>      at java.sql.DriverManager.getConnection(DriverManager.java:512)
>      at java.sql.DriverManager.getConnection(DriverManager.java:171)
>      at com.lexmark.printer.fglib.vulog.actionPerformed(vulog.java:201)
>      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
>      at
> javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)
>
>      at
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
>      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
>      at
> javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:258)
>
>      at java.awt.Component.processMouseEvent(Component.java:5021)
>      at java.awt.Component.processEvent(Component.java:4818)
>      at java.awt.Container.processEvent(Container.java:1380)
>      at java.awt.Component.dispatchEventImpl(Component.java:3526)
>      at java.awt.Container.dispatchEventImpl(Container.java:1437)
>      at java.awt.Component.dispatchEvent(Component.java:3367)
>      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)
>      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
>      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
>      at java.awt.Container.dispatchEventImpl(Container.java:1423)
>      at java.awt.Window.dispatchEventImpl(Window.java:1566)
>      at java.awt.Component.dispatchEvent(Component.java:3367)
>      at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
>      at
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
>
>      at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
>
>      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
>      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
>      at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
> End of Stack Trace
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>




Re:

From
Barry Lind
Date:
Eric,

I looked at this some more, are you running on a 1.4 JDK?  I can
reproduce this error with a 1.4 JDK, however on a 1.3 JDK it works fine.
  In looking at where the null pointer exception is being thrown it
really looks like a bug in the 1.4 JDK and not a problem with the jdbc code.

Can you try running your code under a 1.3 jdk and see what happens?

thanks,
--Barry

PS. In my reproducing of this problem the stack trace of the NPE is:
java.lang.NullPointerException
    at java.io.PrintWriter.write(PrintWriter.java:247)
    at java.io.PrintWriter.print(PrintWriter.java:392)
    at java.io.PrintWriter.println(PrintWriter.java:529)
    at java.lang.Throwable.printStackTrace(Throwable.java:509)
    at java.sql.SQLException.<init>(SQLException.java:103)
    at org.postgresql.util.PSQLException.<init>(PSQLException.java:39)
    at org.postgresql.Connection.openConnection(Connection.java:304)
    at org.postgresql.Driver.connect(Driver.java:153)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at test3.connect(test3.java:43)
    at test3.run(test3.java:36)
    at test3.main(test3.java:68)

Where Connection.java:304 is:
throw new
PSQLException("postgresql.con.backend",pg_stream.ReceiveString(encoding));

and PSQLException.java:39 is:
super();

The default no arg constructor on java.sql.SQLException is being called
by the call to super() and it is causing a NPE.

The problem shows up when and exception is being thrown, masking the
real problem.  The workaround is to run under jdk1.3 to see the real
error until sun fixes this bug in the 1.4jdk.



Nick Fankhauser wrote:
> Eric-
>
>
>
>>            System.out.println("Driver loaded");
>>            Connection con = DriverManager.getConnection
>>
>>("jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432","db","pw");
>
>
>
> It looks like you haven't specified a database in the URL. I would expect to
> see a URL that looks more like this:
>
> jdbc:postgresql://pgsql-db.lpdev.prtdev.lexmark.com:5432/database-name
>                                                            ^^^^^^^^^^^
>
> Regards,
>
> -Nick
>
> --------------------------------------------------------------------------
> Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
> Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>