You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/05/12 21:30:19 UTC
DO NOT REPLY [Bug 19864] New: -
JNDIRealm NullPointerException / CommunicationException when Context Closed
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19864>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19864
JNDIRealm NullPointerException / CommunicationException when Context Closed
Summary: JNDIRealm NullPointerException / CommunicationException
when Context Closed
Product: Tomcat 4
Version: 4.1.24
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Normal
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: david@daviddewolf.com
When a CommunicationException is thrown in the authenticate(String,String)
method of the JNDIRealm, a NullPointerException is thrown if the exception has
no/null message (which appears to be the case sometimes with the sun.jndi.ldap
provider). This exception is due to the following code which resides within a
catch block:
if (e.getMessage().indexOf("Socket closed") < 0)
throw(e);
This NullPointerException prevents the Realm from authenticating the user (which
it attempts to redo if the CommunicationException was caused by the connection
being closed).
It is also important to note the sun.jndi.ldap provider provides a message of
"connection closed" (when it doesn't contain a null message) when the connection
has been reset. It seems advisable to think about other options for testing if
the connection has been reset (other than testing for indexOf("Socket closed")
since different providers will provide different messages.
Here are the stack traces which led me to these conclusions/fixes:
-- The first excpetion shows the Null pointer:
java.lang.NullPointerException
at org.apache.catalina.realm.JNDIRealm.authenticate(JNDIRealm.java:793)
at
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:263)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
-- The second exception indicating the "connection closed" string
javax.naming.CommunicationException. Root exception is java.io.IOException:
connection closed
at com.sun.jndi.ldap.LdapClient.ensureOpen(LdapClient.java:1648)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:138)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2569)
at com.sun.jndi.ldap.LdapCtx.ensureOpen(LdapCtx.java:2479)
at com.sun.jndi.ldap.LdapCtx.ensureOpen(LdapCtx.java:2453)
at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1850)
at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1755)
at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1680)
at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:328)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:313)
at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:238)
at com.vivare.common.tomcat.JNDIRealm.getUserBySearch(JNDIRealm.java:1022)
at com.vivare.common.tomcat.JNDIRealm.getUser(JNDIRealm.java:915)
at com.vivare.common.tomcat.JNDIRealm.authenticate(JNDIRealm.java:864)
at com.vivare.common.tomcat.JNDIRealm.authenticate(JNDIRealm.java:789)
at
org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:263)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org