tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Gregg" <>
Subject RE: Null Pointer Exception - would you please take a look?
Date Tue, 18 Jun 2002 19:34:29 GMT
First, back-off.  Yeah, maybe some people aren't reading your e-mails
carefully, but some of us are supposed to be billing clients and not
answering your e-mails.

Second, an introduction to the art of reading stack traces.  There's no
problem loading your driver.  If there had been, you would be getting a
different error message.  The connection is not null.  Again, if so, you
never your have gotten as far as you have.  The statement is not null.  If
it was, the stack trace would finish one line earlier than it does.  The
problem is that setString() has been called and there's a NPE.  My educated
guess is that the String param is null.  The username is the parameter
there, BTW.  Look at the Tomcat source.

What puzzles me about your situation is that you say you're accessing a url
(a jsp, right?) that you THINK is protected.  What's the url and what does
your web.xml file say?  Tomcat is obviously trying to log you in via the
JDBCRealm but you said you're not getting prompted to enter a username and
password.  That's a stumper to me.  It at least explains why setString()
might be getting a null param.  With basic authentication, the browser
remembers the login info and resubmits it on every request, I think.  The
only way to log out is to restart your brower.  By default Tomcat caches the
login info also, so you wouldn't see an attempt to hit the db unless you
turned off this caching, which you probably didn't.  So, I would say there's
an issue with web.xml not doing what you think it should do but I can't put
my finger on what it is.  Post your url and web.xml contents.

You might also look at the status codes in the access log.


-----Original Message-----
org]On Behalf Of Eddie Bush
Sent: Tuesday, June 18, 2002 1:57 PM
To: Tomcat Users List;
Subject: Re: Null Pointer Exception - would you please take a look?

I'm getting really annoyed =)  It seems you people haven't actually read my
question thoroughly enough to actually understand what I'm doing.  The
thought crosses my mind that you see the subject and then just scan and put
in some standard "Oh he's an idiot - he needs to do this" response.  The
problem is with a JDBCRealm!  I do NOTHING to send/receive anything to/from
the database.  I was of the understanding that Tomcat did this when I
configured the realm and set up the security-constraint.

While I believe my XML to be valid and correct, I will happily post it for
inspection if someone thinks it would help.  Here is a sequence of what
happens and the actors that are involved:

Actors:  Me and Tomcat

Me:  Enter url of page that is protected by a security constraint into my
browsers address bar.  Press enter.
Tomcat:  Returns to the client a page that looks like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html;

(This is not what the actual page is - it's a JSP file - index.jsp - with
much different content.  Also notice I'm not calling a servlet!  Even if I
were, it wouldn't make a bit of difference at this point because Tomcat
hasn't authenticated me!  This happens when Tomcat should authenticate me -
it is NOT my coding!!!)

In my server log file, I have an error that starts off as:

2002-06-17 12:29:28 [org.apache.catalina.connector.warp.WarpRequestHandler]
    at interbase.interclient.PreparedStatement.setString(Unknown Source)
    at org.apache.catalina.realm.JDBCRealm.credentials(
    at org.apache.catalina.realm.JDBCRealm.authenticate(
    at org.apache.catalina.realm.JDBCRealm.authenticate(

My catalina.out has no indication of anything having gone awry - it merely
has status messages indicating that the server was started (why isn't there
a timestamp in here?).

Any ideas?  Thank you for having actually READ THE ENTIRE MESSAGE so you
UNDERSTAND my problem before having issued a reply =)  Ack!  I'm sorry but
I'm frustrated by the responses I am getting - makes me wanna just jump up
and down and scream at the top of my lungs ... Please - I BEG of you - clue
me in here - any thoughts why this is happening?  Again, I can post my XML
if you think I need to.

A couple of questions people have asked up to this point, along with the

Q: Are you passing a null string?
A: I get this when I try to visit a URL that falls under a security
constraint.  It's a JDBCRealm.  Tomcat handles this - it is not my code.

Q: Are you sure the fields in your table match what Tomcat is expecting?
A: Initially they didn't.  My fields were of length 14 and Tomcat says they
should be 15 -- but they're varchar, so does that really matter?  I rebuilt
the tables so that anything Tomcat uses matches exactly what the docs say -
meaning I made my fields to be of length 15.  I still get the same
response - exactly the same response.

Is this the JDBCRealm?  I put my DB driver in common/lib - so Tomcat SHOULD
be able to find it - right?  Is this the appropriate spot?  Is it possible
(and how possible?) that this is my driver?  I use this driver just fine
doing JDBC stuff all the time - no problem.

Thanks for your time!


----- Original Message -----
From: "August Detlefsen" <>
To: "Tomcat Users List" <>
Sent: Tuesday, June 18, 2002 1:24 PM
Subject: Re: Null Pointer Exception - would you please take a look?

> If you are trying to insert a NULL into a NOT NULL column (or are
> trying to insert special chars or the String is too long), you should
> get a SQLException, not a NullPointerException.
> You should recheck that you are actually getting a valid Connection

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message