You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Daniel Kehoe <ke...@fortuity.com> on 2000/10/18 02:30:27 UTC

[catalina] Null pointer exception in FormAuthenticator

BugRat is not responding. Ok to post this here?

Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
Priority: high
Severity: serious
Confidence: public
Release: 4.0m2
JVM Release: 1.2.2
Operating System: NT
OS Release: 4sp5
Platform: Intel
Synopsis: Null pointer exception in FormAuthenticator

Description:
I have a login form that works fine with TC3.2b2 but fails with TC4.0m2...

java.lang.NullPointerException:
	at 
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthent 
icator.java:195)
	at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase 
.java:430)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java, 
Compiled Code)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java, 
Compiled Code)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
	at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java, 
Compiled Code)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java, 
Compiled Code)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java, 
Compiled Code)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java 
:159)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java, 
Compiled Code)
	at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java, 
  Compiled Code)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java, 
Compiled Code)
	at java.lang.Thread.run(Thread.java:479)

Tomcat 3.x nightly builds are zero K

Posted by Daniel Kehoe <ke...@fortuity.com>.
The nightly builds for the Tomcat 3.x Development Tree are all 0K in size.

I followed the link "Tomcat 3.x Development Tree" on the
"Binary Downloads" page at
http://jakarta.apache.org/downloads/binindex.html

I wanted to try a newer build than TC3.2b6.

Daniel
kehoe@fortuity.com

Re: [catalina] JDBCRealm connectionName and connectionPassword

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Daniel Kehoe wrote:

> JDBCRealm in TC3.2b took a connectionName and connectionPassword from the
> server.xml file but these are gone in Catalina's JDBCRealm.
>
> I used HypersonicSQL previously with TC3.2b2 and it worked fine with the
> following:
>             driverName="org.hsql.jdbcDriver"
>             connectionURL="jdbc:HypersonicSQL:../webapps/weblock/web-inf/db/authori
> connectionURL="jdbc:HypersonicSQL:../webapps/weblock/web-inf/db/authority"
>                 connectionName="sa"
>                 connectionPassword=""
>
> There seems to be no way to pass connectionName and connectionPassword to
> TC4.0m2
> and I get an exception when TC4.0m2 starts:
> java.sql.SQLException: User not found
> thrown at JDBCRealm line 649
>

The Tomcat 4 version of JDBCRealm was ported before these properties were added to the
3.x version.  I'd be happy to commit a patch to bring this up to date if anyone would
volunteer to create it ....

>
> Daniel
> kehoe@fortuity.com
>

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



[catalina] JDBCRealm connectionName and connectionPassword

Posted by Daniel Kehoe <ke...@fortuity.com>.
JDBCRealm in TC3.2b took a connectionName and connectionPassword from the 
server.xml file but these are gone in Catalina's JDBCRealm.

I used HypersonicSQL previously with TC3.2b2 and it worked fine with the 
following:
	    driverName="org.hsql.jdbcDriver"
	    connectionURL="jdbc:HypersonicSQL:../webapps/weblock/web-inf/db/authori 
connectionURL="jdbc:HypersonicSQL:../webapps/weblock/web-inf/db/authority"
		connectionName="sa"
		connectionPassword=""

There seems to be no way to pass connectionName and connectionPassword to 
TC4.0m2
and I get an exception when TC4.0m2 starts:
java.sql.SQLException: User not found
thrown at JDBCRealm line 649

Daniel
kehoe@fortuity.com


Re: [catalina] Null pointer exception in FormAuthenticator

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Daniel Kehoe wrote:

> At 06:22 PM 10/17/00 -0700, you wrote:
> >The particular line in question (like 195 of FormAuthenticator) reads like
> >this:
> >
> >     principal = realm.authenticate(username, password);
> >
> >which should only throw an NPE if you have not configured a realm for this
> >webapp
> >(or for the enclosing <Host> or <Engine> in your server.xml file.  Could
> >you check
> >that file, and/or post it to the list so we can look at it?
>
> Thanks, it was my error. I copied the tag from a TC3.2b2 server.xml file
> without changing the tag name from RequestInterceptor to Realm.
>

Not a problem.  Tomcat shouldn't choke on user errors -- it should (gently :-)
point them out.  Here's at least one more case where we can save someone else the
head scratching ...


> >I'm going to add some validation logic to ensure that a Realm is available
> >if you
> >have specified any sort of authentication -- you'll get an informative logfile
> >message and everyone will be refused access (better safe than sorry ...)
>
> Yes, a logfile message will help anyone else who is as careless as me! How
> about "Realm not found, check your server.xml file."
>

It's there now, and will be in m3 as soon as I build it.

>
> Daniel
> kehoe@fortuity.com
>

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Re: [catalina] Null pointer exception in FormAuthenticator

Posted by Daniel Kehoe <ke...@fortuity.com>.
At 06:22 PM 10/17/00 -0700, you wrote:
>The particular line in question (like 195 of FormAuthenticator) reads like 
>this:
>
>     principal = realm.authenticate(username, password);
>
>which should only throw an NPE if you have not configured a realm for this 
>webapp
>(or for the enclosing <Host> or <Engine> in your server.xml file.  Could 
>you check
>that file, and/or post it to the list so we can look at it?

Thanks, it was my error. I copied the tag from a TC3.2b2 server.xml file 
without changing the tag name from RequestInterceptor to Realm.

>I'm going to add some validation logic to ensure that a Realm is available 
>if you
>have specified any sort of authentication -- you'll get an informative logfile
>message and everyone will be refused access (better safe than sorry ...)

Yes, a logfile message will help anyone else who is as careless as me! How 
about "Realm not found, check your server.xml file."

Daniel
kehoe@fortuity.com

Re: [catalina] Null pointer exception in FormAuthenticator

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
The particular line in question (like 195 of FormAuthenticator) reads like this:

    principal = realm.authenticate(username, password);

which should only throw an NPE if you have not configured a realm for this webapp
(or for the enclosing <Host> or <Engine> in your server.xml file.  Could you check
that file, and/or post it to the list so we can look at it?

I'm going to add some validation logic to ensure that a Realm is available if you
have specified any sort of authentication -- you'll get an informative logfile
message and everyone will be refused access (better safe than sorry ...)

Craig



Daniel Kehoe wrote:

> BugRat is not responding. Ok to post this here?
>
> Project: Tomcat
> Category: Bug Report
> SubCategory: New Bug Report
> Class: swbug
> Priority: high
> Severity: serious
> Confidence: public
> Release: 4.0m2
> JVM Release: 1.2.2
> Operating System: NT
> OS Release: 4sp5
> Platform: Intel
> Synopsis: Null pointer exception in FormAuthenticator
>
> Description:
> I have a login form that works fine with TC3.2b2 but fails with TC4.0m2...
>
> java.lang.NullPointerException:
>         at
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthent
> icator.java:195)
>         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
> .java:430)
>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
>         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java,
> Compiled Code)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
>         at org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java,
> Compiled Code)
>         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java,
> Compiled Code)
>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :159)
>         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
>         at
> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java,
>   Compiled Code)
> at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java,
> Compiled Code)
>         at java.lang.Thread.run(Thread.java:479)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

--
====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat