I created a project with Zend Studio, wich creates the initial structure for
the Zend Framework Application, an Initialize class is created,  at this
point everything works fine, but when i try to open a DB conection i get the
following exception.

Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
default module defined for this application' in
/home/test/library/Zend/Controller/Dispatcher/Standard.php:380
Stack trace:
#0 /home/test/library/Zend/Controller/Dispatcher/Standard.php(203):
Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
#1 /home/test/library/Zend/Controller/Dispatcher/Standard.php(237):
Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
 
#2 /home/test/library/Zend/Controller/Front.php(934):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) 
#3 /home/test/application/bootstrap.php(28):
Zend_Controller_Front->dispatch() 
#4 /home/test/public_html/index.php(8): require('/home/test/a...') 
#5 {main} thrown in
/home/test/library/Zend/Controller/Dispatcher/Standard.php on line 380


the code that seems to trigger this error is this:

public function initDb()
    {
        $config = new Zend_Config_Xml($this->_root .
'/configuration/configuration.xml', 'database');

        $this->_db = Zend_Db::factory($config->production);
        Zend_Db_Table_Abstract::setDefaultAdapter($this->_db);
        
        if($this->_env == 'test'){
                $profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
                $profiler->setEnabled(true);
                
                // Attach the profiler to your db adapter
                $this->_db->setProfiler($profiler);
        }
    }


The exception dissapears when i comment the factory line:

$this->_db = Zend_Db::factory($config->production);


I dont know why this affects the front controller, i found a workaround
setting the default module in the bootstrap, but the default module should
be set by default in the front controller.

any help is appreciated.

info:
Zend Framework: 1.7.6

thanks

-- 
View this message in context: 
http://www.nabble.com/No-default-module-defined-for-this-application-when-instantiating-Zend_Db%3A%3Afactory-tp22426528p22426528.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to