title: ServiceNotFoundException in ZendFramework 2, example from Rob Allen
body: <p>for the past few weeks I have been following ZF2 especially <a href="http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework-2.pdf" rel="nofollow noreferrer"> Rob Allen's 'Album' example </a>, I have created the example DB-'zf2tutorial' and example table-'album', which works fine fetching all the items when I use php-mysql, so problems with the data in the DB. </p>
  
  <p>My local.php looks like this
  <strong>conﬁg.autoload/local.php:</strong></p>
  
  <pre><code>return array(
      'db' =&gt; array
      (
          'driver'         =&gt; "Pdo",
          'dsn'            =&gt; "mysql:dbname=zf2tutorial;hostname=localhost",
          'username'       =&gt; "user", //here I added my valid username 
          'password'       =&gt; "password", //here I added my valid password 
          'driver_options' =&gt; array
          (
              PDO::MYSQL_ATTR_INIT_COMMAND =&gt; "SET NAMES 'UTF8'"
          ),
      ),
  );
  </code></pre>
  
  <p>Module.php 
  **module/Album/Model.php</p>
  
  <pre><code>&lt;?php
  namespace Album;
  
  use Album\Model\AlbumTable;
  
  class Module 
  {
      public function getAutoloaderConfig() 
      {
          return array(
              'Zend\Loader\ClassMapAutoloader' =&gt; array(
                  __DIR__ . '/autoload_classmap.php',
              ),
              'Zend\Loader\StandardAutoloader' =&gt; array(
                  'namespaces' =&gt; array(
                      __NAMESPACE__ =&gt; __DIR__ . '/src/' . __NAMESPACE__,
                  ),
              ),
          );
      }
  
      public function getConfig() 
      {
          return include __DIR__ . '/config/module.config.php';
      }
  
      public function getServiceConfiguration() 
      {
          return array(
  
              'factories' =&gt; array(
  
                  'album-table' =&gt; function($sm) //also tried this 'Album\Model\AlbumTable' =&gt;  function($sm)
                  {
                      $dbAdapter = $sm-&gt;get('db-adapter');//also tried this $dbAdapter = $sm-&gt;get('Zend\Db\Adapter\Adapter');
                      $table = new AlbumTable($dbAdapter);
                      return $table;
                  },
              ),
          );
      }  
  }
  </code></pre>
  
  <p>I just wanted to check whether the zf2turorial/album works or not it does throw this error which is similar to <a href="https://stackoverflow.com/questions/11355126/how-do-i-get-the-service-manager-in-zend-framework-2-beta4-to-create-an-instance">this</a> post here in stackoverlow. </p>
  
  <p>The error which it is throwing is: 
  <strong>Additional information:
  Zend\ServiceManager\Exception\ServiceNotFoundException</strong></p>
  
  <pre><code>File:
  ..\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:392
  Message:
  Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Album\Model\AlbumTable
  </code></pre>
  
  <p>I have followed ZF2 Beta 5 tutorial as well, but still encountering this problem. In case if anyone has a solution, please do share with us.</p>
  
  <p>Thanks</p>