-
error code in LDAP
i am getting this error when callind a servlet using LDAP
netscape.ldap.LDAPException: unable to establish connection (52); DSA is
unavailable Not Authenticated
could any one tell me as to why the connection is not being established???
i am giving the code of the pgm below....
pls tell me
satish
import javax.servlet.*;
import javax.servlet.http.*;
import netscape.ldap.* ;
import java.util.*;
import java.io.*;
public class authenticate extends HttpServlet
{
boolean authed = false ;
String str = "admin" ;
String authpw = "admin" ;
String baseDN = "IMET";
public void init(ServletConfig sc) throws ServletException
{
super.init(sc);
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
LDAPConnection ld = new LDAPConnection() ;
try
{
ld.connect("13 . 200. 32. 55 ", 386) ;
LDAPSearchConstraints cons = ld.getSearchConstraints()
;
cons.setBatchSize(0);
LDAPSearchResults results = ld.search(baseDN, ld.SCOPE_SUB,
"uid = " + str , new String[ ] {ld.NO_ATTRS}, false, cons );
if( ! results.hasMoreElements() )
{
out.println(" uid not found");
}
else if(results.getCount() > 1)
{
out.println(" more than one matching UID
");
}
else
{
LDAPEntry entry = results.next();
String authDN = entry.getDN();
out.println(" UID maps to " + authDN
);
ld.authenticate(authDN, authpw) ;
authed = true ;
}
}
catch(LDAPException e) { out.println( e.toString()
) ; }
if(ld != null && ld.isConnected())
{
try
{
ld.disconnect();
}
catch(LDAPException e) { out.println( e.toString()
) ; }
}
int rc = 0 ;
if( authed)
{
out.println(" Authenticated");
}
else
{
out.println(" Not Authenticated "
);
rc = 1 ;
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks