Home » Enterprise Java » naming

naming

Create an Initial Context to a Directory

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 »

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 »

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 »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns