[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: error while accessing through Java "javax.naming.AuthenticationNotSupportedException: simple"



I did not figure-out the cause of why I am getting this and I did not fix this. But I figured out a work-around for this. Thought might help the community.


I did not provide the SECURITY_AUTHENTICATION attribute. So it took the default of the server configured and it succeeded in authenticating the user Entry.


What I will do next is to figure out what the default authentication is, for my server and try and pass it.


Hope this helps some one out there.




From: Sai [mailto:bangaru.adabala@gmail.com]
Sent: Monday, April 07, 2008 11:32 AM
To: 'openldap-technical@openldap.org'
Subject: error while accessing through Java "javax.naming.AuthenticationNotSupportedException: simple"




I am new to openLDAP. I am configuring it (version: OpenLDAP: slapd 2.3.27) on a Linux machine to use with our Web Application (java). When I try and make a connection I am getting the following error.



javax.naming.AuthenticationNotSupportedException: simple

[4/7/08 10:42:01:887 EDT] 00000026 SystemErr     R    at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:115)



These are the code / attributes I used.



        Hashtable env = new Hashtable();

        env.put( Context.INITIAL_CONTEXT_FACTORY, “com.sun.jndi.ldap.LdapCtxFactory” );

        env.put( Context.PROVIDER_URL, “ldap://<machine name>:<port>” );

        env.put( Context.SECURITY_PRINCIPAL, “cn=uimadmin,ou=UIM,o=nhes,dc=nh,dc=gov” );

        env.put( Context.SECURITY_AUTHENTICATION, “simple” );

        env.put( Context.SECURITY_CREDENTIALS, “<password in plaintext>” );



            context = new InitialDirContext(env);

            System.out.println("CONTEXT OPENED WITH ADMIN ACCOUNT");  


        catch (NamingException ne)

        {   ne.printStackTrace();

            LogManager.logMessage("LDAPManager.getAdminJndiContext()", ne);


        return context;




When I try and do an ldapsearch with a –x option (simple authentication) on the command line, it is returning results successfully. I am also able to connect using ldapbrowser v2.8.2 and see the results.


Any help regarding this is greatly appreciated.


Thanks in advance.