Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connecting LDAP from JSP  RSS feed

 
prithvi s zankat
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am first time using LDAP with JSP. When I try to connect LDAP from my page, the connection is successful when I do it with empty "username" and "password" field. But when I try it with my username-password(i.e. absolutely correct, the exception is thrown. The exception is :
"javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 525, v893]"
--------------------------------
below is my code.

<%
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://postoffice");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,"cn=prithviz"); //when i put login and
env.put(Context.SECURITY_CREDENTIALS,"pri111");//password, i got the exception. If i keep these fields empty, everything goes smoothly.
try{
Context ctx = new InitialDirContext(env);
status = "connected successfully.";
ctx.bind("cn=hello",table);
}
catch(Exception e)
{
status = e.toString();
}
%>
I am using Tomcat 5.5. Could you please tell me what the problem exactly is?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!