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();) System.out.println(e.nextElement());
Is it actually using my jndi.properties? Maybe there is more than one?
ClassLoader loader = Thread.currentThread().getContextClassLoader(); for (Enumeration e = loader.getResources("jndi.properties"); e.hasMoreElements();) System.out.println(e.nextElement());
Referenced by:
Comments