Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

LDAP and JNDI

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heres one;
Im doing a simple LDAP query - the code work fine as an application (using java.exe).
when I cut and paste the function into an applet I get:
Cannot instantite class:com.sun.jndi.Ldap.LdapCtxFactory.
As I mentioned before, the application can find it - why can't the applet???
heres the method code;
private String sortLDAP()
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, " my ldap server");


try
{
DirContext ctx = new InitialDirContext(env);
Attributes answer = ctx.getAttributes("cn = barry, ou=spc, ou=sc");

for (NamingEnumeration ae = answer.getAll(); ae.hasMore()
{
Attribute attr = (Attribute)ae.next();
sDesc += "attribute: " + attr.getID() + "\n";
for (NamingEnumeration e = attr.getAll(); e.hasMore()
{
sDesc += "value: " + e.next() + "\n" ;
}
}

}
catch(NamingException e)
{
sDesc="Exception Thrown: \n" + e.getMessage();
}
return sDesc;
}
any help would be brilliant:
Mike B
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Mike B",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic