Reverted: partially reverted r1765127 to fix classpath issue

(OFBIZ-8337)

The above mentioned revision introduced a regression in which starting
OFBiz in debug mode triggers classpath exceptions due to not finding
certain jars. Upon investigation we realized that the new logic
instantiates the loader class before the custom ClassLoader is
instantiated. The fix would take a bit more time, hence reverting now
to quickly resolve the issue and make the code base ready for the next
release. The revert essentially re-introduce a List<StartupLoader> data
set instead of a single StartupLoader.

This is a minimal revert (less than 400 lines) instead of a full revert
going above 2000 lines because we isolated only the parts that trigger the
regression mentioned above. However, we should ideally revisit this code
and clean it up again with careful attention to the class loading sequence.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1767866 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Taher A. Alkhateeb
2016-11-03 11:03:54 +00:00
parent ef7ce89714
commit aadf556625
8 changed files with 98 additions and 60 deletions
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.ofbiz.base.component.ComponentConfig;
@@ -56,7 +57,12 @@ public class ContainerLoader implements StartupLoader {
public synchronized void load(Config config, List<StartupCommand> ofbizCommands) throws StartupException {
// loaders defined in startup (e.g. main, test, load-data, etc ...)
List<String> loaders = StringUtil.split((String) config.loader.get("profiles"), ",");
List<String> loaders = null;
for (Map<String,String> loaderMap: config.loaders) {
if (module.equals(loaderMap.get("class"))) {
loaders = StringUtil.split((String)loaderMap.get("profiles"), ",");
}
}
// load containers defined in ofbiz-containers.xml
Debug.logInfo("[Startup] Loading containers...", module);