0

I was using successfully the ZfcRbac module for over a year but after my upgrade to ZF2 version 2.5 I'm getting the following error and I have no idea why this is happening, hope you can give me a hand to understand the problem:

Service "ZfcRbac\Guard\RouteGuard" has been requested to plugin manager of type "ZfcRbac\Guard\GuardPluginManager", but couldn't be retrieved. A previous exception of type "Zend\ServiceManager\Exception\ServiceNotCreatedException" has been raised in the process. By the way, a service with the name "ZfcRbac\Guard\RouteGuard" has been found in the parent service locator "Zend\ServiceManager\ServiceManager": did you forget to use $parentLocator = $serviceLocator->getServiceLocator() in your factory code?

This is my stack trace:

#0 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php(312): Zend\ServiceManager\Exception\ServiceLocatorUsageException::fromInvalidPluginManagerRequestedServiceName(Object(ZfcRbac\Guard\GuardPluginManager), Object(Zend\ServiceManager\ServiceManager), 'ZfcRbac\Guard\R...', Object(Zend\ServiceManager\Exception\ServiceNotCreatedException))
#1 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php(120): Zend\ServiceManager\AbstractPluginManager->tryThrowingServiceLocatorUsageException('ZfcRbac\Guard\R...', false, Object(Zend\ServiceManager\Exception\ServiceNotCreatedException))
#2 /var/lib/jenkins/jobs/site/workspace/vendor/zf-commons/zfc-rbac/src/ZfcRbac/Factory/GuardsFactory.php(51): Zend\ServiceManager\AbstractPluginManager->get('ZfcRbac\Guard\R...', Array)
#3 [internal function]: ZfcRbac\Factory\GuardsFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'zfcrbacguards', 'ZfcRbac\Guards')
#4 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(939): call_user_func(Array, Object(Zend\ServiceManager\ServiceManager), 'zfcrbacguards', 'ZfcRbac\Guards')
#5 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(1097): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Array, 'zfcrbacguards', 'ZfcRbac\Guards')
#6 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(638): Zend\ServiceManager\ServiceManager->createFromFactory('zfcrbacguards', 'ZfcRbac\Guards')
#7 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(598): Zend\ServiceManager\ServiceManager->doCreate('ZfcRbac\Guards', 'zfcrbacguards')
#8 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#9 /var/lib/jenkins/jobs/site/workspace/vendor/zf-commons/zfc-rbac/src/ZfcRbac/Module.php(44): Zend\ServiceManager\ServiceManager->get('ZfcRbac\Guards')
#10 [internal function]: ZfcRbac\Module->onBootstrap(Object(Zend\Mvc\MvcEvent))
#11 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#12 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('bootstrap', Object(Zend\Mvc\MvcEvent), Array)
#13 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-mvc/src/Application.php(157): Zend\EventManager\EventManager->trigger('bootstrap', Object(Zend\Mvc\MvcEvent))
#14 /var/lib/jenkins/jobs/site/workspace/vendor/zendframework/zend-mvc/src/Application.php(261): Zend\Mvc\Application->bootstrap(Array)
#15 /var/lib/jenkins/jobs/site/workspace/httpdocs/index.php(33): Zend\Mvc\Application::init(Array)
#16 {main}

I'm loading all the classes through composer autoloader. If I disable the module in config/application.config.php I get the site to work correctly.

Thanks in advance.

markdrake
  • 624
  • 7
  • 12
  • 2
    `...did you forget to use $parentLocator = $serviceLocator->getServiceLocator() in your factory code?` well, did you? – Ankh Jul 14 '15 at 15:52
  • The problem is that the GuardPluginManager instantiates the different guards and passes over the options you configured in your config files. And that code was working fine without any intervention before. However when we did a couple of changes like upgrading zend framework library got it broken. I still can't fix that box but I guess we'll have to stick to the old version a little longer. – markdrake Jul 15 '15 at 16:34

0 Answers0