Jump to content

Fatal error: Uncaught exception 'Adapter_Exception' with message 'Service container is not set.'


Recommended Posts

Hoi, ik heb geen idee of ik dit in het juiste forum post, maar ik had het al op een stackexchange website gezet in het engels:

http://webmasters.stackexchange.com/questions/100305/adapter-exception-with-message-service-container-is-not-set-adapter-serviceloc

 

--

 

So I have the exact line of code and file where it went wrong, but I have no idea how to fix it. It happened when someone pressed the 'update all' button.

Fatal error: Uncaught exception 'Adapter_Exception' with message 'Service container is not set.' in \prestashop\Adapter\Adapter_ServiceLocator.php:49 Stack trace: #0 \prestashop\classes\ObjectModel.php(232): Adapter_ServiceLocator::get('Adapter_EntityM...') #1 \prestashop\classes\shop\Shop.php(131): ObjectModelCore->__construct('1', NULL, NULL) #2 \prestashop\classes\shop\Shop.php(397): ShopCore->__construct('1') #3 \prestashop\config\config.inc.php(94): ShopCore::initialize() #4 \prestashop\index.php(27): require('...') #5 {main} thrown in \prestashop\Adapter\Adapter_ServiceLocator.php on line 49

I shortened the path in the error a bit to keep it more readable. this error causes my site to be unavailable.

By editing line 49 in Adapter_ServiceLocator.php to this:

throw new Adapter_Exception('Service container is not set. for service ' .$serviceName);

I got this message:

Service container is not set. for service Adapter_EntityMapper

Maybe that makes more sense? I still have no clue.

 

Link to comment
Share on other sites

  • 3 weeks later...

I had the same problem.
Now I found the reason - the method of Adapter_ServiceLocator.php get() using private field $service_container, which should be intalized with method setServiceContainerInstance(). I found the initializing in /config/bootstrap.php. But it wasnt any includes of the file bootstrap.php!

So you should download fresh version of Prestashop and rewrite the /config/config.inc.php.

Because it must contain

require_once $currentDir . DIRECTORY_SEPARATOR . 'bootstrap.php';

I hope it will help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...