HP3000-L Archives

January 2001, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Whitlock, Joseph L" <[log in to unmask]>
Reply To:
Whitlock, Joseph L
Date:
Thu, 18 Jan 2001 06:45:09 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (166 lines)
HP3000-L and Gavin,

I was able to solve this problem with the help from the following;

Joseph,

the NullPointerException happens because the 6.0 Express-1 JDBC
driver has a problem with JDK 1.2 and later. There is a workaround
documented in the 6.0 Express-1 Communicator article. Something
with adding a statement like DriverManager.setLogStream(System.err);
before doing the Class.forName(...) loading. The Communicator may
have a typo (DriveManager instead of DriverManager), but I do not
recall that by heart.

Lars.

PS... The JDBC driver version 1.1.4 is fixed in this and other issues.

and

Hi,

try :

....
  DriverManager.setLogStream( System.out); // Bcause PointerException.
  connection = DriverManager.getConnection(url, username, password);
....

Fabrice

/***********************************************************************
        Fabrice VIAULT
        [log in to unmask]

        Cheops technology France            Tel. +33 (0)2 51 13 23 33
        1, Impasse des Jades                Fax +33 (0)2 51 13 23 39
        BP 83883                            e-mail : [log in to unmask]
        44338 - NANTES CEDEX 03             Web    : Under Reconstruction

***********************************************************************/

Thanks All !!!

*
Joseph Whitlock
The Boeing Company
P.O. Box 3707
Mail Code 6C-LU
Seattle, WA. 98124

Phone:      425-234-1478
Email:        [log in to unmask]


> ----------
> From:         Gavin Scott[SMTP:[log in to unmask]]
> Sent:         Wednesday, January 17, 2001 11:36 PM
> To:   Joseph Whitlock; [log in to unmask]
> Subject:      Re: [HP3000-L] Loading the HP JDBC driver (Java) second try
>
> Joe writes:
>
> > I compiled my VerySimpleJdbc.java program that is a copy of Cordlandt
> > Wilsons example.
> >
> > I'm getting a PointerException.
>
> Actually you're getting a "NullPointerException", the "UAE" and "GPF" of the
> Java world (practically any failing operation will return a reference to
> Null, and not noticing the error before trying to use the reference results
> in the NullPointerException.  A good candidate for World's Most Generic
> Error Condition.
>
> > Does any on have an idea whats going on!
>
> Don't know much about JDBC internals, but rearranging your trace a bit:
>
> > java.lang.NullPointerException
> > at java.io.Writer.<init>(Writer.java:75)
> > at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:98)
> > at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:87)
> > at java.io.PrintWriter.<init>(PrintWriter.java:110)
> > at java.io.PrintWriter.<init>(PrintWriter.java:94)
> > at com.hp.jdbc.allbase.JdbcDriver.<clinit>(JdbcDriver.java:77)
> > at java.lang.Class.forName0(Native Method)
> > at java.lang.Class.forName(Class.java:124)
> > at VerySimpleJdbc.main(VerySimpleJdbc.java:15)
>
> Reading up the trace from the bottom, the failure likely is occuring on the
> explicit call to Class.forName(<your JDBC driver class name>) that you
> typically see at the start of any JDBC program.  By asking for a reference
> to the Class object for the driver's class, you cause the system to load
> that class, and the initialization (construction) of the Class object allows
> the class to register itself with the rest of the JDBC code (which also gets
> loaded as a side effect).
>
> It looks like you found com.hp.jdbc.allbase.JdbcDriver ok, and it tried to
> create a PrintWriter object which created an OutputStreamWriter object which
> created a Writer object which probably was the first thing to actually
> *look* at the parameters meing passed to the constructor, and one of them
> turned out to be Null.  So perhaps the JDBC driver object failed to open
> some connection or file and didn't check the status before trying to wrap
> that stream in a PrintWriter object (bad driver <thwack!>).
>
> The trace leading up to the ultimate NullPointerException is mostly standard>
> Java initialization and all the standard classes that end up getting loaded
> as a result of even the simplest reference to any sort of object.  The
> interesting stuff starts when your main class gets loaded:
>
> > [Loaded VerySimpleJdbc]
> > Start VerySimpleJdbc
> > [Loaded java.lang.Package from /usr/local/java/jdk1.2.2/jre/lib/rt.jar]
> > [Loaded com.hp.jdbc.allbase.JdbcDriver]
> > [Loaded com.hp.jdbc.allbase.Jdbc]
> > [Loaded java.sql.Driver from /usr/local/java/jdk1.2.2/jre/lib/rt.jar]
>
> The next three Exception classes that get loaded may be normal operation or
> they may be getting loaded in response to actually being trown by the
> internals of the JDBC SQL stuff, which again may or may not indicate the
> first problem.
>
> > [Loaded java.sql.SQLException from
> > /usr/local/java/jdk1.2.2/jre/lib/rt.jar]
> > [Loaded java.lang.NumberFormatException from
> > /usr/local/java/jdk1.2.2/jre/lib/rt
> > .jar]
> > [[Loaded java.lang.IllegalArgumentException from
> > /usr/local/java/jdk1.2.2/jre/lib
> > /rt.jar]
>
> Here we're loading the "Connection" class, and the next class that gets
> loaded is PrintWriter which we see in our stack trace, so perhaps the JDBC
> driver tried to create a Connection object, this failed, it didn't check,
> and then tried to use an output stream associated with the Connection to
> create a PrintWriter.  Since the output stream field was Null, eventually
> someone notices and bang you get your NullPointerException which isn't
> really helpful in indicating what went wrong.
>
> > [Loaded java.sql.Connection from
> > /usr/local/java/jdk1.2.2/jre/lib/rt.jar]
> > [Loaded java.io.PrintWriter from
> > /usr/local/java/jdk1.2.2/jre/lib/rt.jar]
> > [Loaded java.sql.DriverManager from
> > /usr/local/java/jdk1.2.2/jre/lib/rt.jar]
> > [Loaded java.lang.NullPointerException from
> > /usr/local/java/jdk1.2.2/jre/lib/rt.
> > jar]
> > [Loaded java.lang.ExceptionInInitializerError from
> > /usr/local/java/jdk1.2.2/jre/
> > lib/rt.jar]
> > Exception in thread "main" java.lang.ExceptionInInitializerError:
> > java.lang.NullPointerException
>
> All of this is mostly in the wild-ass-guess category though.
>
> Not sure what to look at as far as a solution.  Obviously check eveything
> that would be different on your system versus the author's system such as
> the URL you're going to connect to, the installation of the JDBC stuff, and
> I assume that your 3000 has TCP/IP networking configured and running and
> that you've started the LOOP NI (:NETCONTROL START;NET=LOOP) and that the
> JDBC listener is ready to receive connections.
>
> G.
>

ATOM RSS1 RSS2