The com.ibm.websphere.naming.JndiHelper class contains static methods to simplify common JNDI programming and administration tasks.
These helper class functions include:
import com.ibm.websphere.naming.JndiHelper; ... try { Context startingContext = new InitialContext(); startingContext = startingContext.lookup("com/mycompany"); // Create each intermediate subcontext, if necessary, as well as leaf context. // AlreadyBoundException is not thrown. JndiHelper.recursiveCreateSubcontext(startingContext, "apps/ accounting"); } catch (NamingException e){ // Handle other errors. }
import com.ibm.websphere.naming.JndiHelper; ... try { Context startingContext = new InitialContext(); // Creates each intermediate subcontext, if necessary, and rebinds object. JndiHelper.recursiveRebind(startingContext, "com/mycompany/apps/accounting", someObject); } catch (NamingException e){ // Handle other errors. }