Java Mailing List Archive

http://www.junlu.com/

Google
Google
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
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
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 Source code of java.lang.NullPointerException

           at
org.apache.catalina.realm.JNDIRealm Source code of org.apache.catalina.realm.JNDIRealm(JNDIRealm.java:1555)

           at
org.apache.catalina.realm.JNDIRealm Source code of org.apache.catalina.realm.JNDIRealm(JNDIRealm.java:1502)

           at
org.apache.catalina.realm.RealmBase Source code of org.apache.catalina.realm.RealmBase(RealmBase.java:1198)

           at
org.apache.catalina.realm.RealmBase Source code of org.apache.catalina.realm.RealmBase(RealmBase.java:436)

           at
org.apache.catalina.authenticator.SSLAuthenticator Source code of org.apache.catalina.authenticator.SSLAuthenticator(SSLAuthentic
ator.java:148)

           at
org.apache.catalina.authenticator.AuthenticatorBase Source code of org.apache.catalina.authenticator.AuthenticatorBase(AuthenticatorBase
.java:490)

           at
org.apache.catalina.core.StandardHostValve Source code of org.apache.catalina.core.StandardHostValve(StandardHostValve.java:126
)

           at
org.apache.catalina.valves.ErrorReportValve Source code of org.apache.catalina.valves.ErrorReportValve(ErrorReportValve.java:105
)

           at
org.apache.catalina.core.StandardEngineValve Source code of org.apache.catalina.core.StandardEngineValve(StandardEngineValve.java
:107)

           at
org.apache.catalina.connector.CoyoteAdapter Source code of org.apache.catalina.connector.CoyoteAdapter(CoyoteAdapter.java:148)

           at
org.apache.jk.server.JkCoyoteHandler Source code of org.apache.jk.server.JkCoyoteHandler(JkCoyoteHandler.java:199)

           at
org.apache.jk.common.HandlerRequest Source code of org.apache.jk.common.HandlerRequest(HandlerRequest.java:282)

           at
org.apache.jk.common.ChannelSocket Source code of org.apache.jk.common.ChannelSocket(ChannelSocket.java:754)

           at
org.apache.jk.common.ChannelSocket Source code of org.apache.jk.common.ChannelSocket(ChannelSocket.java:684)

           at
org.apache.jk.common.ChannelSocket Source code of org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java
:876)

           at
org.apache.tomcat.util.threads.ThreadPool Source code of org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)

           at java.lang.Thread Source code of 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.

©2008 junlu.com - Jax Systems, LLC, U.S.A.