diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index a5624d7..951cc9e 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -60,10 +60,8 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
   /**
    * Holds a list of enabled modules and their paths.
    *
-   * This is used to store module data as a container parameter so that it can
-   * be retrieved for registering namespaces when using a compiled container.
-   * When not using a compiled container, the namespaces get registered during
-   * the process of building the container.
+   * This is used to store module location info as a container parameter so that
+   * it can be used by services.
    *
    * @var array
    *   An associative array whose keys are module names and whose values are
@@ -72,6 +70,20 @@ class DrupalKernel extends Kernel implements DrupalKernelInterface {
   protected $modulePaths = array();
 
   /**
+   * Holds a list of module namespaces.
+   *
+   * This is used to store namespaces as a container parameter which can then be
+   * retrieved for registering namespaces when using a compiled container.
+   * When not using a compiled container, the namespaces get registered during
+   * the process of building the container.
+   *
+   * @var array
+   *   An associative array whose keys are module namespaces and whose values
+   *   are full module namespace paths.
+   */
+  protected $moduleNamespaces = array();
+
+  /**
    * PHP code storage object to use for the compiled container.
    *
    * @var \Drupal\Component\PhpStorage\PhpStorageInterface
@@ -179,27 +191,28 @@ public function registerBundles() {
     $bundles = array(
       new CoreBundle(),
     );
+
     if (!isset($this->moduleList)) {
       $module_list = $this->configStorage->read('system.module');
       $this->moduleList = isset($module_list['enabled']) ? $module_list['enabled'] : array();
     }
 
-    $namespaces = $this->classLoader->getNamespaces();
     // We will need to store module locations in a container parameter so that
     // we can register all namespaces when using a compiled container.
-    $this->modulePaths = array();
+    $this->modulePaths = $this->moduleNamespaces = array();
+
     foreach ($this->moduleList as $module => $weight) {
       // When installing new modules, the modules in the list passed to
       // updateModules() do not yet have their namespace registered.
       $namespace = 'Drupal\\' . $module;
-      if (!isset($namespaces[$namespace]) && $this->moduleData($module)) {
-        $path = dirname(DRUPAL_ROOT . '/' . $this->moduleData($module)->uri) . '/lib';
+      if ($this->moduleData($module)) {
+        $path = $this->moduleData($module)->uri;
         $this->modulePaths[$module] = $path;
-        $this->classLoader->registerNamespace($namespace, $path);
-      }
-      else {
-        $this->modulePaths[$module] = $namespaces[$namespace];
+        $full_path = dirname(DRUPAL_ROOT . '/' . $path) . '/lib';
+        $this->classLoader->registerNamespace($namespace, $full_path);
+        $this->moduleNamespaces[$namespace] = $full_path;
       }
+
       $camelized = ContainerBuilder::camelize($module);
       $class = "Drupal\\{$module}\\{$camelized}Bundle";
       if (class_exists($class)) {
@@ -207,6 +220,7 @@ public function registerBundles() {
         $this->bundleClasses[] = $class;
       }
     }
+
     // Add site specific or test bundles.
     if (!empty($GLOBALS['conf']['container_bundles'])) {
       foreach ($GLOBALS['conf']['container_bundles'] as $class) {
@@ -318,13 +332,10 @@ protected function initializeContainer() {
     if (isset($this->container)) {
       // All namespaces must be registered before we attempt to use any service
       // from the container.
-      $namespaces = $this->classLoader->getNamespaces();
-      foreach ($this->container->getParameter('container.modules') as $module => $path) {
-        $namespace = 'Drupal\\' . $module;
-        if (!isset($namespaces[$namespace])) {
-          $this->classLoader->registerNamespace($namespace, $path);
-        }
+      foreach ($this->container->getParameter('container.namespaces') as $namespace => $path) {
+        $this->classLoader->registerNamespace($namespace, $path);
       }
+
       $module_list = $this->moduleList ?: $this->container->get('config.factory')->get('system.module')->load()->get('enabled');
       if (array_keys((array)$module_list) !== array_keys($this->container->getParameter('container.modules'))) {
         unset($this->container);
@@ -355,6 +366,7 @@ protected function buildContainer() {
     $container = $this->getContainerBuilder();
     $container->setParameter('container.bundles', $this->bundleClasses);
     $container->setParameter('container.modules', $this->modulePaths);
+    $container->setParameter('container.namespaces', $this->moduleNamespaces);
     // Register the class loader as a synthetic service.
     $container->register('class_loader', 'Symfony\Component\ClassLoader\UniversalClassLoader')->setSynthetic(TRUE);
     foreach ($this->bundles as $bundle) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php
index c313d82..1d074d0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php
@@ -81,7 +81,7 @@ function testCompileDIC() {
     // Test that our synthetic services are there.
     $classloader = $container->get('class_loader');
     $refClass = new ReflectionClass($classloader);
-    $this->assertTrue($refClass->hasMethod('getNamespaces'), 'Container has a classloader');
+    $this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a classloader');
 
     // We make this assertion here purely to show that the new container below
     // is functioning correctly, i.e. we get a brand new ContainerBuilder
@@ -112,7 +112,12 @@ function testCompileDIC() {
     // Test that our synthetic services are there.
     $classloader = $container->get('class_loader');
     $refClass = new ReflectionClass($classloader);
-    $this->assertTrue($refClass->hasMethod('getNamespaces'), 'Container has a classloader');
+    $this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a classloader');
+    // Check that the namespace of the new module is registered.
+    $namespaces = $container->getParameter('container.namespaces');
+    $full_path = dirname(DRUPAL_ROOT . '/' . drupal_get_path('module', 'bundle_test')) . '/lib';
+    $this->assertEqual($namespaces['Drupal\\bundle_test'], $full_path);
+
 
     // Restore the original container.
     drupal_container($original_container);
