This discussion is archived
1 2 Previous Next 17 Replies Latest reply: May 20, 2013 11:41 PM by EJP Go to original post RSS
  • 15. Re: javax.naming.InvalidNameException
    EJP Guru
    Currently Being Moderated
    I've already told you you don't need that.
    String keystore = "C:\\Program Files\\Java\\jdk1.6.0_26\\jre\\lib\\security\\cacerts";
    Or that.
    env.put(Context.SECURITY_PRINCIPAL, "ispl\\dmptest");
    env.put(Context.SECURITY_CREDENTIALS, "test@123");
    So if the rest of this succeeds, 'dmptest' must have permission to change that password.
  • 16. Re: javax.naming.InvalidNameException
    972794 Newbie
    Currently Being Moderated
    If I remove those two lines, I am getting the following errors:

    it works!!
    bind error: javax.naming.CommunicationException: simple bind failed: ********:636 [Root exception is PKIX path building failed: unable to find valid certification path to requested target]

    Here is my code after removing those lines:
    public void tabOut(ValueChangeEvent valueChangeEvent) {
    DirContext ldapContext;
    String baseName = "cn=users, CN=APOPSDC, DC=ispl, DC=com"; 
    String modelUsername = "template";
    String userName = "CN= ********,CN=Users,DC=ispl,DC=com";
    try {
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap:// ********:636");
    env.put(Context.SECURITY_AUTHENTICATION, "Simple");
    env.put(Context.SECURITY_PRINCIPAL, "ispl
    env.put(Context.SECURITY_CREDENTIALS, " ********");
    env.put(Context.SECURITY_PROTOCOL, "ssl");
    System.out.println("it works!!");
    LdapContext ctx = new InitialLdapContext(env,null);
    System.out.println("Context Sucessfully Initialized");
    ModificationItem[] mods = new ModificationItem[1];
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userpassword" ,"Aptuit*1" ));
    System.out.println("New Modification");
    System.out.println("step 3");
    ctx.modifyAttributes(userName, mods);
    System.out.println("step 4");
    System.out.println("success base");
    } catch (Exception e) {
    System.out.println(" bind error: " + e);
    Edited by: Infanta on May 20, 2013 11:07 PM

    Edited by: EJP on 21/05/2013 16:40
  • 17. Re: javax.naming.InvalidNameException
    EJP Guru
    Currently Being Moderated
    Your truststore doesn't trust the server certificate. This is an SSL problem, not a JNDI problem.

    You're printing 'it works!' too soon. Nothing has actually happened yet.
1 2 Previous Next