Jump to content
jphellemons

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.

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More