1 2 Previous Next 17 Replies Latest reply: May 21, 2013 1:41 AM by EJP Go to original post RSS
      • 15. Re: javax.naming.InvalidNameException
        EJP
        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";
        System.setProperty("javax.net.ssl.trustStore",keystore);
        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
          Hi,
          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";
          System.out.println("works");
          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
          dmptest");
          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");
          System.out.println(ctx.getEnvironment());
          ModificationItem[] mods = new ModificationItem[1];
          System.out.println("step1");
          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);
          e.printStackTrace();
          System.exit(-1);
          }
          }
          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
            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