I am using Jboss 4.2.3 and I am trying to connect to LDAP server and calling this piece of code to create the initial context:
Hashtable<String, String> environment = new Hashtable<String, String>();
environment.put(Context.PROVIDER_URL, ldapUrl);
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.SECURITY_AUTHENTICATION, "simple");
environment.put(Context.SECURITY_PROTOCOL, "ssl");
environment.put(Context.REFERRAL, "follow");
environment.put(Context.SECURITY_PRINCIPAL, principalName);
environment.put(Context.SECURITY_CREDENTIALS, plainPassword);
environment.put("com.sun.jndi.ldap.connect.pool", "true");
environment.put("com.sun.jndi.ldap.connect.timeout", "1500");
context = new InitialLdapContext(environment, null);
The Initial context creation is taking 12 seconds which is not acceptable. However, if I run this same program as a standalone java program in the same system, it executes in 1 second.
How can I analyse the cause for this delay inside the JBoss server ? How do I debug this problem ? Kindly help