简体   繁体   English

Symfony2 FOSUserBundle-您已请求一个不存在的服务“ security.user_checker”

[英]Symfony2 FOSUserBundle - You have requested a non-existent service “security.user_checker”

I use Symfony 2 and the FOSUserBundle. 我使用Symfony 2和FOSUserBundle。 I can login, logout and view Profile. 我可以登录,注销和查看个人资料。

Problem: When i go to "/register", fill out the form and press enter i get the following error: 问题:当我转到“ / register”时,填写表格并按Enter,我得到以下错误:

You have requested a non-existent service "security.user_checker". 您请求的服务不存在“ security.user_checker”。 500 Internal Server Error - ServiceNotFoundException 500内部服务器错误-ServiceNotFoundException

It seems that I have do to some additional configuration or so, but I can't find anything about it. 似乎我已经对一些其他配置进行了修改,但是我对此一无所获。

Part of config.yml: config.yml的一部分:

fos_user:
    db_driver: orm
    firewall_name: fos_user
    user_class: Blogger\BlogBundle\Entity\User

security.yml: security.yml:

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface: sha512

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    providers:
        in_memory:
            users:
                user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
        fos_user:
            id: fos_user.user_manager

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        fos_user:
            pattern:    ^/
            provider:   fos_user
            form_login:
                check_path: /login_check
                login_path: /login
            logout:
                path:   /logout
                target: /
            anonymous: ~

    access_control:
        - { path: /secured/admin, roles: ROLE_ADMIN }
        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }

UPDATE UPDATE

Stack trace: 堆栈跟踪:

http://i.stack.imgur.com/vsGwF.png

Make sure you specify a version for FOSUserBundle. 确保为FOSUserBundle指定一个版本。 The repository head is aligned with Symfony head, not 2.0.9. 存储库头与Symfony头对齐,而不是2.0.9。

[FOSUserBundle]
    git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
    target=/bundles/FOS/UserBundle
    version=1.0.0

If you're updating FOSUserBundle (or any bundle for that matter) you need to make sure you mimic changes made in the FOSUserBundle to any files you overwrite. 如果要更新FOSUserBundle(或与此相关的任何捆绑软件),则需要确保将在FOSUserBundle中所做的更改模拟为覆盖的所有文件。

In my particular case, in the RegistrationController FOSUserBundle changed a value from security.user_checker to fos_user.user_checker in the authenticateUser method, so I made the same change in my controller. 在我的特定情况下,在RegistrationController中,FOSUserBundle在authenticateUser方法中将值从security.user_checker更改为fos_user.user_checker,因此我在控制器中进行了相同的更改。

Every time you do an update of the vendors, you need to make sure files (controllers, services etc) you're overwriting in your bundle are not depending on a service class or method that has been removed. 每次更新供应商时,都需要确保要在捆绑软件中覆盖的文件(控制器,服务等)不依赖于已删除的服务类或方法。

Do you register services right ? 您注册服务了吗? Or maybe You forgot add a routing for this service ? 或者,也许您忘记为此服务添加路由?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Symfony3您已请求不存在的服务“学说”。 MongoDB FOSUserBundle - Symfony3 You have requested a non-existent service “doctrine”. MongoDB FOSUserBundle Symfony2:您已请求不存在的参数 - Symfony2: You have requested a non-existent parameter Symfony2:您请求的服务“ jms_aop.pointcut_container”不存在。 - Symfony2: You have requested a non-existent service “jms_aop.pointcut_container”. 在 Symfony2 Beta3 中不断收到“您请求了一个不存在的服务“test.client”” - Keep getting 'You have requested a non-existent service “test.client”' in Symfony2 Beta3 Symfony 4.1:你请求了一个不存在的服务“主义” - Symfony 4.1 : You have requested a non-existent service "doctrine" 您已请求不存在的服务“security.context” - You have requested a non-existent service “security.context” 您请求的服务“ user_service”不存在 - You have requested a non-existent service “user_service” [Symfony2] [SwiftMailer]您请求的参数“ sender_name”不存在 - [Symfony2][SwiftMailer] You have requested a non-existent parameter “sender_name” Symfony2致命错误您请求的参数java_path不存在 - Symfony2 fatal error You have requested a non-existent parameter java_path Symfony 4:您请求的参数“区域设置”不存在 - Symfony 4: You have requested a non-existent parameter "locale"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM