static void initializeContainer(String args[])
      throws SAXException, JAXBException, FileNotFoundException, MalformedURLException,
          ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
          IllegalArgumentException, InvocationTargetException, InstantiationException,
          ConfigurationException, Exception {
    // Logger.getLogger("com.stratuscom.harvester.AnnotatedClassDeployer").setLevel(Level.ALL);
    Logger.getLogger(CommandLineArgumentParser.class.getName()).setLevel(Level.ALL);

    ContainerConfig coreConfig = readCoreConfig();
    Map<String, ClassLoader> classLoaders = createClassLoaders(coreConfig);

    ClassLoader containerClassLoader = classLoaders.get(Strings.CONTAINER_CLASS_LOADER);

    /*
    Create the context object.
    */
    Object context = Class.forName(Strings.CONTEXT_CLASS, true, containerClassLoader).newInstance();
    Method putByNameMethod =
        context.getClass().getMethod(Strings.PUT, new Class[] {String.class, Object.class});
    Method initCompleteMethod = context.getClass().getMethod(Strings.INIT_COMPLETE, new Class[0]);
    Thread.currentThread().setContextClassLoader(containerClassLoader);
    putByNameMethod.invoke(context, Strings.CLASS_LOADERS, (Object) classLoaders);

    /* Store a link to the context in the context. */
    putByNameMethod.invoke(context, Strings.CONTEXT, context);

    /*
    Process the core configuration
    */
    processConfiguration(coreConfig, containerClassLoader, context);
    /*
    We need to set the command line args after processing the core
    configuration so that the items in the core-config get initialized.
    */
    putByNameMethod.invoke(context, Strings.COMMAND_LINE_ARGS, (Object) args);
    /*
    The core configuration now loads the profile configuration...
    */
    // processConfiguration(containerConfig, classLoader, putMethod, context, putByNameMethod);
    initCompleteMethod.invoke(context, new Object[0]);
  }
  private static ClassLoader resolveClassLoader(
      Map<String, ClassLoader> classLoaders,
      List<String> seen,
      Map<String, Classpath> classpaths,
      String id)
      throws MalformedURLException {
    if (classLoaders.containsKey(id)) {
      return classLoaders.get(id);
    }
    if (seen.contains(id)) {
      throw new ConfigurationException(MessageNames.CIRCULAR_CLASSPATH, id);
    }
    // Add the id to the list of classloaders we have attempted to build.
    seen.add(id);
    Classpath classpath = classpaths.get(id);
    if (classpath == null) {
      throw new ConfigurationException(MessageNames.CLASSPATH_UNDEFINED, id);
    }
    String parentClasspathId = classpath.getParent();
    ClassLoader parentClassLoader = null;
    if (parentClasspathId != null && !Strings.EMPTY.equals(parentClasspathId)) {
      parentClassLoader = resolveClassLoader(classLoaders, seen, classpaths, parentClasspathId);
    } else {
      /* Should be the 'extension' classloader. */
      parentClassLoader = Bootstrap.class.getClassLoader().getParent();
    }
    URL[] classpathUrls;
    classpathUrls = findClasspathURLS(classpath.getValue());

    SettableCodebaseClassLoader classLoader =
        new SettableCodebaseClassLoader(classpathUrls, parentClassLoader);
    classLoaders.put(id, classLoader);
    log.log(
        Level.FINE,
        MessageNames.CONFIGURED_CLASSPATH,
        new Object[] {id, Utils.format(classpathUrls)});
    seen.remove(id);
    return classLoader;
  }
  private static Map<String, ClassLoader> createClassLoaders(ContainerConfig config)
      throws MalformedURLException {

    Map<String, ClassLoader> classLoaders = new HashMap<String, ClassLoader>();
    classLoaders.put(Strings.BOOTSTRAP_CLASS_LOADER, Bootstrap.class.getClassLoader());
    /*
    Setup the classloaders according to the config file.
    */
    List<String> seen = new LinkedList<String>();
    Map<String, Classpath> classpaths = new HashMap<String, Classpath>();
    for (Classpath classpath : config.getClasspath()) {
      if (classpaths.containsKey(classpath.getId())) {
        throw new ConfigurationException(MessageNames.DUPLICATE_CLASSPATH, classpath.getId());
      }
      classpaths.put(classpath.getId(), classpath);
    }

    for (String id : classpaths.keySet()) {
      resolveClassLoader(classLoaders, seen, classpaths, id);
    }
    return classLoaders;
  }