Improve JNDI detection logic

Update JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable() to
call `getEnvironment()` on the `InitialContext` in order to actually
trigger a NamingException if JNDI is not available.

Issue: SPR-12223
This commit is contained in:
Phillip Webb
2014-09-18 23:09:45 -07:00
parent f259ca1b1f
commit 2077388f38
2 changed files with 38 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ public class JndiLocatorDelegate extends JndiLocatorSupport {
*/
public static boolean isDefaultJndiEnvironmentAvailable() {
try {
new InitialContext();
new InitialContext().getEnvironment();
return true;
}
catch (Throwable ex) {