I am upgrading our magento 2.1.9 to magento 2.2.7.
When reindexing catalog_category_product, it throw this error:
[23-Jan-2019 09:49:39 UTC] PHP Fatal error: Uncaught Error: Cannot instantiate interface MagentoFrameworkIndexerIndexTableRowSizeEstimatorInterface in /home/don/Web/fabelio22/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:111
Stack trace:
#0 /home/don/Web/fabelio22/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject('Magento\Framewo...', Array)
#1 /home/don/Web/fabelio22/vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): MagentoFrameworkObjectManagerFactoryCompiled->create('Magento\Framewo...')
#2 /home/don/Web/fabelio22/vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): MagentoFrameworkObjectManagerFactoryCompiled->get('Magento\Framewo...')
#3 /home/don/Web/fabelio22/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryCompiled->create('Magento\Framewo...')
#4 /home/don/Web/fabelio22/vendor/magento/module-catalog/Model/Indexer/Category/Product/Action/Full.ph in /home/don/Web/fabelio22/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 111
The di.xml in Magento_Catalog is
<type name="MagentoCatalogModelIndexerCategoryProductActionFull">
<arguments>
<argument name="batchRowsCount" xsi:type="number">100000</argument>
<argument name="batchSizeManagement" xsi:type="object">MagentoCatalogModelIndexerCategoryProductBatchSize</argument>
</arguments>
</type>
<virtualType name="MagentoCatalogModelIndexerCategoryProductBatchSize" type="MagentoFrameworkIndexerBatchSizeManagement">
<arguments>
<argument name="rowSizeEstimator" xsi:type="object">MagentoCatalogModelIndexerCategoryProductRowSizeEstimator</argument>
</arguments>
</virtualType>
But $rowSizeEstimator is not injected with the correct class.It tries to instantiate MagentoFrameworkIndexerIndexTableRowSizeEstimatorInterface instead. generated/metadata/global.php is generated, but it’s like Magento ignore the compiled di file.
2
Answers
Try clearing the cache and generation directories.
var/generation
var/cache
bin/magento setup:upgrade
andbin/magento setup:di:compile
Note: If you use redis for caching then you should also consider clearing redis cache.
I have faced the similar issue i.e. cannot instantiate interface for some third party module.
The reason that I found out after debugging that the corresponding module’s entry was missing from the app/etc/config.xml but the module’s code was present in the codebase.
After manually adding the module’s entry in the app/etc/config.xml file, the issue got resolved.