In this example we are going to see how to create an Initial Context to a Directory. This example uses the JNDI/LDAP service provider to connect to an LDAP server on the local machine. In order to do that you should : Create a new Hashtable. Use put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory") Use put(Context.PROVIDER_URL, "ldap://localhost/o=JNDIExample"). For simple authentication we can use : env.put(Context.SECURITY_AUTHENTICATION, "simple") ...
Read More »Home »
Parsing a JNDI compound name example
In this example we are going to see how to perform Parsing on JNDI compound name. This example parses a compound name using a parser from an LDAP service in which components are arranged from right to left, delimited by the comma character (,). The LDAP service is running on localhost and on default port (389) Parsing a JNDI compound ...
Read More »Parsing a JNDI composite name example
In this example we are going to see how to perform Parsing on JNDI composite name. In composite names components are / delimited. We are going to use cn=byron,o=hits/reports/summary.xls as a composite name. Basically in order to Parse JDNI composite name,one should follow these steps: Create a new CompositeName. Use composite.get to get the component you want by providing its index. Use composite.add(0, "jcg.com") to ...
Read More »Locating adding replacing removing and renaming a binding in the Naming service
With this example we are going to show you how to perform basic operations over a binding in a Naming service, that is locating adding replacing removing and renaming a binding in the Naming service. In order to run this example you should first follow the one describing how to implement a simple “calculator” service capable of RMI invocations here. ...
Read More »Create an Initial Context to the Naming service
With this tutorial we shall show you how to create an Initial Context to the Naming service to get you going. This example uses the default naming service provider setup on the JVM. For connecting to alternate naming service providers you should construct a Hashtable containing appropriate environment directives and initialize the InitialContext Object using the InitialContext(Hashtable env) constructor injecting ...
Read More »