How to list all JNDI entries in java: global namespace

The goal is to programmatically view all JNDI entries. new InitialContext().list("java:global") does not work.

EJB 3.1, Wildfly or Glassfish 4

+6
source share
1 answer

I think a safer way to navigate in the JNDI namespace is to first root it and then list its contents.

I tried this way in WildFly 8.1.0 and it worked:

  Context root = (Context) new InitialContext().lookup("java:global"); NamingEnumeration<NameClassPair> names = root.list(""); 
+5
source

Source: https://habr.com/ru/post/976969/


All Articles