Skip to main content

How to debug com.sun.jndi.ldap

No replies
Joined: 2010-11-15

What is the best way to debug com.sun.jndi.ldap classes?

I'm using the sun jndi ldap implementation to authenticate users. It works, but frequently (and seemingly randomly) there is a 15 seconds delay in connecting to the LDAP server. Here are a few things I've tried:

  • I've added the system property to get additional output (ssl is being used). I'm not sure what to look for but one interesting thing is that it appears closing the connection causes a " Connection reset by peer: socket write error"
  • I've connected to the process using JConsole and obtained a stack trace. I'm not sure I'm catching the thread at the right moment, but it looks like it is hanging on
  • I've downloaded source from, and attached a debugger, but the source doesn't line up with the binary. Know where I can get source for com.sun.jndi.ldap.* as used in Java 1.6 build 20?

Here is the line that occasionally hangs for 15 seconds:
ctx = new InitialLdapContext(env, null);