1

THIS IS THE ERROR:

"Fatal Error: 'Uncaught Error: Cannot instantiate interface SimplifiedMagento\\Custom2\\Api\\PositionRepositoryInterface in \/Applications\/MAMP\/htdocs\/Magento2_3\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php:50\nStack trace:\n#0 \/Applications\/MAMP\/htdocs\/Magento2_3\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('SimplifiedMagen...')\n#1 \/Applications\/MAMP\/htdocs\/Magento2_3\/vendor\/magento\/module-webapi\/Controller\/Rest\/SynchronousRequestProcessor.php(90): Magento\\Framework\\ObjectManager\\ObjectManager->get('SimplifiedMagen...')\n#2 \/Applications\/MAMP\/htdocs\/Magento2_3\/vendor\/magento\/module-webapi\/Controller\/Rest.php(188): Magento\\Webapi\\Controller\\Rest\\SynchronousRequestProcessor->process(Object(Magento\\Framework\\Webapi\\Rest\\Request\\Proxy))\n#3 \/Applications\/MAMP\/htdocs\/Magento2_3\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#4 \/Applica' in '\/Applications\/MAMP\/htdocs\/Magento2_3\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php' on line 50"
15
  • Have you create di for your PositionRepositoryInterface if not, please create one and compile your code, if you still face the same issue please share your di.xml code – Ashish Ranade Dec 10 '19 at 6:32
  • di.xml file: <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="SimplifiedMagento\Custom2\Api\Data\PositionInterface" type="SimplifiedMagento\Custom2\Model\Data\Position" /> <preference for="SimplifiedMagento\Custom2\Api\PositionRepositoryInterface" type="SimplifiedMagento\Custom2\Model\PositionRepository" /> </config> – Ankur Anand Dec 10 '19 at 7:35
  • your di.xml looks fine, try to delete your generated directory and run di:compile again. – Ashish Ranade Dec 10 '19 at 7:43
  • Should i delete the generated directory or inner files of generated directory? – Ankur Anand Dec 10 '19 at 7:46
  • i am ruuning the API on POSTMAN. Do i need to make any changes in POSTMAN before running the API? – Ankur Anand Dec 10 '19 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.