@Override protected Context getDefaultInitCtx() throws NamingException { if (!gotDefault) { // if there is an initial context factory prop in the env use it to create the default ctx final String factoryClassName = myProps != null ? (String) myProps.get(Context.INITIAL_CONTEXT_FACTORY) : null; if(factoryClassName == null || InitialContextFactory.class.getName().equals(factoryClassName)) { defaultInitCtx = new DefaultInitialContext(myProps); } else { final ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); defaultInitCtx = ((javax.naming.spi.InitialContextFactory)factoryClass.newInstance()).getInitialContext(myProps); } catch (NamingException e) { throw e; } catch (Exception e) { throw NamingLogger.ROOT_LOGGER.failedToInstantiate(e, "InitialContextFactory", factoryClassName, classLoader); } } gotDefault = true; } return defaultInitCtx; }
@Override protected Context getDefaultInitCtx() throws NamingException { if (!gotDefault) { // if there is an initial context factory prop in the env use it to create the default ctx final String factoryClassName = myProps != null ? (String) myProps.get(Context.INITIAL_CONTEXT_FACTORY) : null; if(factoryClassName == null || InitialContextFactory.class.getName().equals(factoryClassName)) { defaultInitCtx = new DefaultInitialContext(myProps); } else { final ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); defaultInitCtx = ((javax.naming.spi.InitialContextFactory)factoryClass.newInstance()).getInitialContext(myProps); } catch (NamingException e) { throw e; } catch (Exception e) { throw NamingLogger.ROOT_LOGGER.failedToInstantiate(e, "InitialContextFactory", factoryClassName, classLoader); } } gotDefault = true; } return defaultInitCtx; }
@Override protected Context getDefaultInitCtx() throws NamingException { if (!gotDefault) { // if there is an initial context factory prop in the env use it to create the default ctx final String factoryClassName = myProps != null ? (String) myProps.get(Context.INITIAL_CONTEXT_FACTORY) : null; if(factoryClassName == null || InitialContextFactory.class.getName().equals(factoryClassName)) { defaultInitCtx = new DefaultInitialContext(myProps); } else { final ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { final Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader); defaultInitCtx = ((javax.naming.spi.InitialContextFactory)factoryClass.newInstance()).getInitialContext(myProps); } catch (NamingException e) { throw e; } catch (Exception e) { throw NamingLogger.ROOT_LOGGER.failedToInstantiate(e, "InitialContextFactory", factoryClassName, classLoader); } } gotDefault = true; } return defaultInitCtx; }