I'm a new comer to LDAP. I've adopted http://confluence.atlassian.com/display/CROWD/Creating+a+Connection+to+your+LDAP+Directory
for fundamental understanding and seeking to setup LDAP for my office use.

scenario:
I've began Apache 2.2 (Apache Directory Server) at localhost:389 and it is running fine.

Next, i installed Apache Directory Studio and seeking to produce new connection. But I get the next error while opening theconnection:

Error while opening connection - localhost:389; socket closed  
  javax.naming.ServiceUnavailableException: localhost:389; socket closed  
    at com.sun.jndi.ldap.Connection.readReply(Unknown Source)  
    at com.sun.jndi.ldap.LdapClient.ldapBind(Unknown Source)  
    at com.sun.jndi.ldap.LdapClient.authenticate(Unknown Source)  
    at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)  
    at com.sun.jndi.ldap.LdapCtx.ensureOpen(Unknown Source)  
    at com.sun.jndi.ldap.LdapCtx.ensureOpen(Unknown Source)  
    at com.sun.jndi.ldap.LdapCtx.reconnect(Unknown Source)  
    at javax.naming.ldap.InitialLdapContext.reconnect(Unknown Source)  
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper$7.run(JNDIConnectionWrapper.java:1055)  
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.runAndMonitor(JNDIConnectionWrapper.java:1272)  
    at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.doBind(JNDIConnectionWrapper.java:1065)  
   at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.bind(JNDIConnectionWrapper.java:254)  
   at org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable.run(OpenConnectionsRunnable.java:114)  
   at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:114)  
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)  

Please guide me!

I resolved this by altering the main harbour amounts.
Now i'm obtaining the following error:
Error while opening connection
- [LDAP: error code 49 - cannot bind the principalDn.]
javax.naming.AuthenticationException: [LDAP: error code 49 - cannot bind the principalDn.]
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.ensureOpen(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.ensureOpen(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.reunite(Unknown Source)
at javax.naming.ldap.InitialLdapContext.reunite(Unknown Source)
at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper$7.run(JNDIConnectionWrapper.java:1055)
at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.runAndMonitor(JNDIConnectionWrapper.java:1272)
at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.doBind(JNDIConnectionWrapper.java:1065)
at org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.bind(JNDIConnectionWrapper.java:254)
at org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable.run(OpenConnectionsRunnable.java:114)
at org.apache.directory.studio.connection.core.jobs.StudioConnectionJob.run(StudioConnectionJob.java:114)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Thanks
Sneha