Version 7

    Useful routines for debugging naming problems


    What naming environment is actually getting used?


    new InitialContext().getEnvironment();


    What is actually bound in that context?


    new InitialContext().listBindings(""); // Global namespace
    new InitialContext().listBindings("java:/"); // java namespace (same VM only)
    new InitialContext().listBindings("java:/comp"); // Component namespace
    new InitialContext().listBindings("java:/comp/env"); // ENC
    new InitialContext().listBindings("java:/comp/env/ejb"); // EJB refs (if you follow the standard)
    new InitialContext().listBindings("some/context");


    e.g. List global bindings

    for (Enumeration e = new InitialContext().listBindings(""); e.hasMoreElements();)



    Is it actually using my Maybe there is more than one?


    ClassLoader loader = Thread.currentThread().getContextClassLoader();
    for (Enumeration e = loader.getResources(""); e.hasMoreElements();)



    Referenced by: