1 2 Previous Next 17 Replies Latest reply on May 21, 2013 6:41 AM by EJP Go to original post
      • 15. Re: javax.naming.InvalidNameException
        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        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
          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 javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: 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
            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