Hi all, I just got finished installed some new extensions in my Magento 2.1.7 store, however when I try to click on any link on my store to go to the page, I get this error...
Fatal error: Uncaught Error: Cannot instantiate abstract class Magento\Framework\App\Action\Action in /var/www/html/*/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93
My abtract file reads like this...
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\App\Action;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\ResultInterface;
use Magento\Framework\Exception\NotFoundException;
/**
* Default implementation of application action controller
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
abstract class Action extends AbstractAction
{
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
protected $_objectManager;
/**
* Namespace for session.
* Should be defined for proper working session.
*
* @var string
*/
protected $_sessionNamespace;
/**
* @var \Magento\Framework\Event\ManagerInterface
*/
protected $_eventManager;
/**
* @var \Magento\Framework\App\ActionFlag
*/
protected $_actionFlag;
/**
* @var \Magento\Framework\App\Response\RedirectInterface
*/
protected $_redirect;
/**
* @var \Magento\Framework\App\ViewInterface
*/
protected $_view;
/**
* @var \Magento\Framework\UrlInterface
*/
protected $_url;
/**
* @var \Magento\Framework\Message\ManagerInterface
*/
protected $messageManager;
/**
* @param Context $context
*/
public function __construct(Context $context)
{
parent::__construct($context);
$this->_objectManager = $context->getObjectManager();
$this->_eventManager = $context->getEventManager();
$this->_url = $context->getUrl();
$this->_actionFlag = $context->getActionFlag();
$this->_redirect = $context->getRedirect();
$this->_view = $context->getView();
$this->messageManager = $context->getMessageManager();
}
/**
* Dispatch request
*
* @param RequestInterface $request
* @return ResponseInterface
* @throws NotFoundException
*/
public function dispatch(RequestInterface $request)
{
$this->_request = $request;
$profilerKey = 'CONTROLLER_ACTION:' . $request->getFullActionName();
$eventParameters = ['controller_action' => $this, 'request' => $request];
$this->_eventManager->dispatch('controller_action_predispatch', $eventParameters);
$this->_eventManager->dispatch('controller_action_predispatch_' . $request->getRouteName(), $eventParameters);
$this->_eventManager->dispatch(
'controller_action_predispatch_' . $request->getFullActionName(),
$eventParameters
);
\Magento\Framework\Profiler::start($profilerKey);
$result = null;
if ($request->isDispatched() && !$this->_actionFlag->get('', self::FLAG_NO_DISPATCH)) {
\Magento\Framework\Profiler::start('action_body');
$result = $this->execute();
\Magento\Framework\Profiler::start('postdispatch');
if (!$this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) {
$this->_eventManager->dispatch(
'controller_action_postdispatch_' . $request->getFullActionName(),
$eventParameters
);
$this->_eventManager->dispatch(
'controller_action_postdispatch_' . $request->getRouteName(),
$eventParameters
);
$this->_eventManager->dispatch('controller_action_postdispatch', $eventParameters);
}
\Magento\Framework\Profiler::stop('postdispatch');
\Magento\Framework\Profiler::stop('action_body');
}
\Magento\Framework\Profiler::stop($profilerKey);
return $result ?: $this->_response;
}
/**
* Throw control to different action (control and module if was specified).
*
* @param string $action
* @param string|null $controller
* @param string|null $module
* @param array|null $params
* @return void
*/
protected function _forward($action, $controller = null, $module = null, array $params = null)
{
$request = $this->getRequest();
$request->initForward();
if (isset($params)) {
$request->setParams($params);
}
if (isset($controller)) {
$request->setControllerName($controller);
// Module should only be reset if controller has been specified
if (isset($module)) {
$request->setModuleName($module);
}
}
$request->setActionName($action);
$request->setDispatched(false);
}
/**
* Set redirect into response
*
* @param string $path
* @param array $arguments
* @return ResponseInterface
*/
protected function _redirect($path, $arguments = [])
{
$this->_redirect->redirect($this->getResponse(), $path, $arguments);
return $this->getResponse();
}
/**
* @return \Magento\Framework\App\ActionFlag
*/
public function getActionFlag()
{
return $this->_actionFlag;
}
}
Can anyone help? Thanks
The error is coming from AbstractFactory class and ObjectManager.
Simple solution would be , Remove that var/generation , var/cache , var/page_cache directory from your root directory.
You can remove it by below commands.
rm -rf var/generation rm -rf var/cache rm -rf var/page_cache
Then after run below commands.
php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento cache:clean php bin/magento cache:flush
I have same issue, tried running above commands. But when I access storefront it shows following error. Any solution to this would be really helpful.
Error: Cannot instantiate abstract class Magento\Wishlist\Block\AbstractBlock in /var/www/html/magento_1/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121
Stack trace: #0 /var/www/html/magento_1/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() #1 /var/www/html/magento_1/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create() #2 /var/www/html/magento_1/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get() #3 /var/www/html/magento_1/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Compiled->create() #4 /var/www/html/magento_1/app/code/MGS/Mpanel/Block/Framework/Page.php(36): Magento\Framework\ObjectManager\ObjectManager->get() #5 /var/www/html/magento_1/app/code/MGS/Mpanel/Block/Framework/Page.php(27): MGS\Mpanel\Block\Framework\Page->getStoreConfig() #6 /var/www/html/magento_1/vendor/magento/framework/View/Result/Page.php(245): MGS\Mpanel\Block\Framework\Page->addDefaultBodyClasses() #7 /var/www/html/magento_1/vendor/magento/framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render() #8 /var/www/html/magento_1/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult() #9 /var/www/html/magento_1/vendor/magento/framework/Interception/Interceptor.php(138): MGS\Mpanel\Block\Framework\Page\Interceptor->___callParent() #10 /var/www/html/magento_1/vendor/magento/framework/Interception/Interceptor.php(153): MGS\Mpanel\Block\Framework\Page\Interceptor->Magento\Framework\Interception\{closure}() #11 /var/www/html/magento_1/generated/code/MGS/Mpanel/Block/Framework/Page/Interceptor.php(23): MGS\Mpanel\Block\Framework\Page\Interceptor->___callPlugins() #12 /var/www/html/magento_1/vendor/magento/framework/App/Http.php(120): MGS\Mpanel\Block\Framework\Page\Interceptor->renderResult() #13 /var/www/html/magento_1/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->launch() #14 /var/www/html/magento_1/pub/index.php(29): Magento\Framework\App\Bootstrap->run() #15 {main}
Try this command line
php bin/magento setup:upgrade
Although this command was run, it was needed to be runned again after flushed caches. Thanks pro4soft106b35
Hi Manthan,
Removing following files:
and running all magento commands resolved this issue:
[error] 41712#41712: *45313 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Cannot instantiate abstract class Magento\Framework\Model\ResourceModel\AbstractResource in /data/docroot/prxm2stage.iksulalive.com/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
Stack trace:
#0 /data/docroot/prxm2stage.iksulalive.com/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...')
#1 /data/docroot/prxm2stage.iksulalive.com/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...')
#2 /data/docroot/prxm2stage.iksulalive.com/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'resource', 'Iksula\\Echeck\\M...')
#3 /data/docroot/prxm2stage.iksulalive.com/vendor/magento/framework/ObjectManager/Factory/AbstractFacto" while reading response header from upstream, client: 114.143.241.74, server: prxm2stage2.iksulalive.com, request: "GET /checkout HTTP/1.1", upstream: "fastcgi://127.0.0.1:9200", host: "prxm2stage2.iksulalive.com", referrer: "https://prxm2stage2.iksulalive.com/"