Glassfish JNDI settings

Recently we had the need to add some configurable settings (such as user credentials) in a Java EE 7 application running on Glassfish 4.0. An example method to read the values might look like this: private String getUserProperty(String property) { String result = ""; Properties properties; try { InitialContext context = new InitialContext(); properties = (Properties) context.lookup("jndi/userinfo"); result = properties.getProperty(property); context.close(); } catch (NamingException e) { } return result; } Setting the values via the Glassfish console is achieved via Resources -> JNDI -...