  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | JNDI Realm NPE | JNDI Realm NPE 2006-11-23 - By pgodot
Back Hi tomcat list,
I'm trying to setup a JNDIRealm and I recieved a NPE if the user is not in the LDAP Server:
java.lang.NullPointerException 
at org.apache.catalina.realm.JNDIRealm (JNDIRealm.java:1555)
at org.apache.catalina.realm.JNDIRealm (JNDIRealm.java:1502)
at org.apache.catalina.realm.RealmBase (RealmBase.java:1198)
at org.apache.catalina.realm.RealmBase (RealmBase.java:436)
at org.apache.catalina.authenticator.SSLAuthenticator (SSLAuthentic ator.java:148)
at org.apache.catalina.authenticator.AuthenticatorBase (AuthenticatorBase .java:490)
at org.apache.catalina.core.StandardHostValve (StandardHostValve.java:126 )
at org.apache.catalina.valves.ErrorReportValve (ErrorReportValve.java:105 )
at org.apache.catalina.core.StandardEngineValve (StandardEngineValve.java :107)
at org.apache.catalina.connector.CoyoteAdapter (CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler (JkCoyoteHandler.java:199)
at org.apache.jk.common.HandlerRequest (HandlerRequest.java:282)
at org.apache.jk.common.ChannelSocket (ChannelSocket.java:754)
at org.apache.jk.common.ChannelSocket (ChannelSocket.java:684)
at org.apache.jk.common.ChannelSocket $SocketConnection.runIt(ChannelSocket.java :876)
at org.apache.tomcat.util.threads.ThreadPool $ControlRunnable.run(ThreadPool.jav a:684)
at java.lang.Thread (Thread.java:595)
This NPE arrived in the Realm and then tomcat doen't present any error page.
I checked quickly the JNDI realm code and so that:
/**
* Return the Principal associated with the given user name.
*/
protected synchronized Principal getPrincipal(DirContext context,
String username)
throws NamingException {
User user = getUser(context, username);
return new GenericPrincipal(this, user.username, user.password ,
getRoles(context, user));
}
But the getUser method return null when user is not found in the LDAP .
If the user is referenced in the LDAP all is ok !!!!
Thanks,
Phil
This email (and any attachments) contains confidential information, and is intended only for the named recipient. Distribution or copying of this email by anyone other than the named recipient is prohibited. If you are not the named or intended recipient, please notify TEMENOS or the sender immediately and permanently destroy this email (and any attachments) and all copies of it. No member of TEMENOS Group AG or any of its associated or affiliated companies is liable for any errors or omissions in the content or transmission of this email. Any opinions contained in this email are solely those of the author and, unless clearly indicated otherwise in writing, are not endorsed by any member of TEMENOS Group AG or any of its associated and affiliated companies.
|
|
 |