Question about InitialLdapContext

L

laredotornado

Hi,

I'm using java 1.5 with WebLogic 9.2.2 on Solaris 9. We are
initializing our active directory context like so ...


Hashtable env = new Hashtable(5, 0.75f);
...
env.put(Context.PROVIDER_URL, this.ACTIVE_DIR_SERVER);
InitialLdapContext context = null;
...
context = new InitialLdapContext(env, null);


We are setting our active directory server to "ldap://
XXXXXXXXLDP01.cable.myco.com:999/ou=Users,ou=AAS
Services,ou=Corporate,dc=cable,dc=myco,dc=com". Notice the space in
"AAS Services". This seems to be cauisng NamingExceptions. The
exception in our log file is:


FATAL 2009-03-05 18:12:52,214 -
[com.myco.nps.im.utils.SecureADUserAuthentication::authenticateAD] -
The Primary Active Directory authentication
FAILED:javax.naming.NamingException: Cannot parse url:
Services,ou=Corporate,dc=cable,dc=myco,dc=com [Root exception is
java.net.MalformedURLException: Invalid URI:
Services,ou=Corporate,dc=cable,dc=myco,dc=com]


Do I need to be doing some data massaging to the active directory URl
before I pass it to the initial context?

Thanks, - Dave
 
O

Owen Jacobson

Hi,

I'm using java 1.5 with WebLogic 9.2.2 on Solaris 9. We are
initializing our active directory context like so ...


Hashtable env = new Hashtable(5, 0.75f);
...
env.put(Context.PROVIDER_URL, this.ACTIVE_DIR_SERVER);
InitialLdapContext context = null;
...
context = new InitialLdapContext(env, null);


We are setting our active directory server to "ldap://
XXXXXXXXLDP01.cable.myco.com:999/ou=Users,ou=AAS
Services,ou=Corporate,dc=cable,dc=myco,dc=com". Notice the space in
"AAS Services". This seems to be cauisng NamingExceptions. The
exception in our log file is:


FATAL 2009-03-05 18:12:52,214 -
[com.myco.nps.im.utils.SecureADUserAuthentication::authenticateAD] -
The Primary Active Directory authentication
FAILED:javax.naming.NamingException: Cannot parse url:
Services,ou=Corporate,dc=cable,dc=myco,dc=com [Root exception is
java.net.MalformedURLException: Invalid URI:
Services,ou=Corporate,dc=cable,dc=myco,dc=com]

Spaces are not legal characters in a URL (along with a few others).
Construct a java.net.URI or java.net.URL from your initial String, then
convert that back to a String - it should handle the escaping for you.
Read the docs on those classes and the various URL/URI RFCs for the
(*surprisingly* bloody) details.

-o
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top