I have Magento enterprise version 2.4.5-p1, I am getting following error in the system.log
Error:- .CRITICAL: Error: Cannot instantiate abstract class Magento\Framework\Model\ResourceModel\AbstractResource in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121
I thought the issue is in this constructor parameter code which I have overridden from default Magento RMA's Model,
public function __construct(
 \Magento\Framework\Model\Context $context,
 \Magento\Framework\Registry $registry,
 \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
 AttributeValueFactory $customAttrFactory,
 \Magento\Store\Model\StoreManagerInterface $storeManager,
 \Magento\Rma\Model\RmaFactory $rmaFactory,
 \Magento\Rma\Model\Config $rmaConfig,
 \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
 \Magento\Framework\Stdlib\DateTime\DateTime $dateTimeDateTime,
 \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
 \Magento\Rma\Helper\Data $rmaHelper,
 TimezoneInterface $localeDate,
 RmaRepositoryInterface $rmaRepoInterface,
 RmaAttributesManagementInterface $metadataService,
 AddressRenderer $addressRenderer,
 RmaEntityFactory $customReturn,
 \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
 \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
 array $data = []
) {
 parent::__construct(
 $context,
 $registry,
 $extensionFactory,
 $customAttrFactory,
 $storeManager,
 $rmaFactory,
 $rmaConfig,
 $transportBuilder,
 $dateTimeDateTime,
 $inlineTranslation,
 $rmaHelper,
 $localeDate,
 $rmaRepoInterface,
 $metadataService,
 $addressRenderer,
 $resource,
 $resourceCollection,
 $data
 );
 $this->storeManager = $storeManager;
 $this->rmaConfig = $rmaConfig;
 $this->transportBuilder = $transportBuilder;
 $this->inlineTranslation = $inlineTranslation;
 $this->rmaHelper = $rmaHelper;
 $this->addressRenderer = $addressRenderer;
 $this->customReturn = $customReturn;
}
Can anyone have idea, where am I doing wrong ?
Thanks in advance
- 
 run this command and check it resolved or not ? rm -rf generated/* var/cache var/page_cacheCharmi Patel– Charmi Patel2023年05月24日 11:56:07 +00:00Commented May 24, 2023 at 11:56
- 
 Also Need to check all variables passed of the parent class in the construct or notCharmi Patel– Charmi Patel2023年05月24日 12:05:20 +00:00Commented May 24, 2023 at 12:05
- 
 @CharmiPatel, appreciate your response, I already passed all the parents class parameters in constructor, and also tried running deploy command and tried removing generated and var folderMitul Vadalia– Mitul Vadalia2023年05月24日 15:07:43 +00:00Commented May 24, 2023 at 15:07
- 
 please replace with the whole file hereCharmi Patel– Charmi Patel2023年05月25日 04:20:51 +00:00Commented May 25, 2023 at 4:20
1 Answer 1
This happens when any of our custom or third party extension has default parameter in between for __construct() arguments instead of at the end. (Optional parameter should be add at the end in custom extension or third party extension)
Please check which action you're performing while getting this error. One of the classes involved in this action can have a default parameter in between, like below:
Need to move array $data = [] at the last position because it has a default value.
Explore related questions
See similar questions with these tags.