Uncaught exception ‘Zend_Controller_Dispatcher_Exception’ with message ‘Invalid controller class (“Error_ErrorController”)

error-handlingmodulezend-framework

i create 3 module for my proj
like this:

application/module/admin

application/module/default

application/module/error

every module has itself cnotroller , view , layout folder. every things is correct in default module, but when i go to admin module i saw this error (www.domain.com/public/admin)

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller class ("Error_ErrorController")' in E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:347 Stack trace: #0 E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(256): Zend_Controller_Dispatcher_Standard->loadClass('ErrorController') #1 E:\xampp\php\PEAR\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #2 E:\zend_progamming\donyaye_fan_zend\application\Bootstrap.php(110): Zend_Controller_Front->dispatch() #3 E:\zend_progamming\donyaye_fan_zend\public\index.php(5): Bootstrap->runApp() #4 {main} thrown in E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php on line 347

this is my bootstrap code that has relation with this error:

$frontController->addModuleDirectory(ROOT_DIR . '/application/modules'); 
$frontController->setDefaultModule('default');
$frontController->registerPlugin(new Places_Controller_Plugin_ModuleSetup());
$frontController->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
        'module'     => 'error',
        'controller' => 'error',
        'action'     => 'error'
    )));

and this is my modulesetup class:

class Places_Controller_Plugin_ModuleSetup  extends Zend_Controller_Plugin_Abstract{    public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{

    // Set the layout directory for the loaded module
    $layoutPath = ROOT_DIR . '/application/modules/' . $request->getModuleName() . '/layouts/scripts/';
    Zend_Layout::startMvc(array('layoutPath' =>$layoutPath));

    $autoloader = new Zend_Application_Module_Autoloader(array(
        'namespace' => '',
        'basePath' => ROOT_DIR . "/modules/",
    ));
    $autoloader->addResourceTypes(array(
    'admin' => array(
            'path'      => 'admin/',
            'namespace' => 'admin'
        ),
        'error' => array(
            'path'      => 'error/',
            'namespace' => 'error')));

}

}

Best Solution

i found the answer : in errorController must put error directory name befor class name ,like error_errorController