Index: lams_common/src/java/org/lamsfoundation/lams/util/Configuration.java =================================================================== diff -u -r59f646f493089d9dd6ac7ea5d4ce77fbb8babe4d -r3e7ee4e7075a1f360de05a43f6630ed3d8b95c6b --- lams_common/src/java/org/lamsfoundation/lams/util/Configuration.java (.../Configuration.java) (revision 59f646f493089d9dd6ac7ea5d4ce77fbb8babe4d) +++ lams_common/src/java/org/lamsfoundation/lams/util/Configuration.java (.../Configuration.java) (revision 3e7ee4e7075a1f360de05a43f6630ed3d8b95c6b) @@ -206,15 +206,16 @@ new Thread("LAMSConfigurationServerStateCheckThread") { @Override public void run() { - // In WildFly 14 the Configuration bean can get created by one of LAMS EAR modules, for example Image Gallery. - // This module's classloader does not have access to java.sql.Connection. - // It should ask its parent for this class, but context class loaders are not obliged to do it and - // apparently WildFly module classloaders do not do it. - // We need to manually reset a classloader for this thread. - Thread.currentThread() - .setContextClassLoader(Thread.currentThread().getContextClassLoader().getParent()); boolean check = true; do { + // In WildFly 14 the Configuration bean can get created by one of LAMS EAR modules, for example Image Gallery. + // This module's classloader does not have access to java.sql.Connection. + // It should ask its parent for this class, but context class loaders are not obliged to do it and + // apparently WildFly module classloaders do not do it. + // We need to manually reset a classloader for this thread. + // For some reason we need to do it within this loop, not just in run() method. + Thread.currentThread() + .setContextClassLoader(Thread.currentThread().getContextClassLoader().getParent()); try (ModelControllerClient client = ModelControllerClient.Factory.create("localhost", 9990)) { // try every 5 seconds Thread.sleep(5000);