Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unable to get connection

1 view
Skip to first unread message

Greg Allen

unread,
Oct 30, 2009, 9:48:33 AM10/30/09
to
Hello,

I posted this on mozilla.dev.tech.ldap, but it may make more sense in this
group...

I am using the following code to simply connect to an ApacheDS LDAP server
from JS:

function verifyLogin() {

alert ("in verifyLogin");
var server =
Components.classes["@mozilla.org/network/ldap-server;1"].createInstance(Components.interfaces.nsILDAPServer)
var url_str = "ldap://localhost:10389";
server.key = "ldap";
server.username = "uid=admin,ou=system";
server.password = "secret";
server.binddn = "uid=admin,ou=system";
server.sizelimit = 100;
var url =
Components.classes["@mozilla.org/network/ldap-url;1"].createInstance(Components.interfaces.nsILDAPURL)
url.init (Components.interfaces.nsIStandardURL.URLTYPE_STANDARD, 10389,
url_str, null, null);
server.url = url;

var ldapSvc =
Components.classes["@mozilla.org/network/ldap-service;1"].getService(Components.interfaces.nsILDAPService);
alert ("got service");
ldapSvc.addServer (server);

alert ("added server");
try {
var conn = ldapSvc.getConnection ("ldap");
} catch (exce) {
alert (exce);
}

alert ("got connection");
ldapSvc.releaseConnection ("ldap");
alert ("released connection");
ldapSvc.deleteServer ("ldap");
alert ("leaving verifyLogin");
}

Things work fine until the call to ldapSvc.getConnection. At that point I
get the following exception:

[Exception... "Component returned failure code: 0x80004005
(NS_ERROR_FAILURE) [nsILDAPService.getConnection]" nsresult: "0x80004005
(NS_ERROR_FAILURE)" location: "JS frame ::
chrome://calendar/content/account.js :: verifyLogin :: line 82" data: no]

I have verifed the URL and username/password using Apache Directory Studio.
Everything looks good.

Can anyone tell me what is wrong?

Thanks,

-- Greg

0 new messages