[英]Symfony2 AuthenticationCredentialsNotFoundException @Route
AuthenticationCredentialsNotFoundException in classes.php line 2876:
classes.php 第 2876 行中的 AuthenticationCredentialsNotFoundException:
The token storage contains no authentication token.
令牌存储不包含身份验证令牌。 One possible reason may be that there is no firewall configured for this URL.
一个可能的原因可能是没有为此 URL 配置防火墙。
I tried everything I could find on Stack Overflow, GitHub and Google.我尝试了所有可以在 Stack Overflow、GitHub 和 Google 上找到的东西。 Nothing worked.
没有任何效果。
Lesson learned: Always check the log files.经验教训:始终检查日志文件。
tail -f app/logs/dev.log
Found this:发现这个:
...[Semantical Error] The annotation \\"@Route\\" in method Ambry\\TumorNextAPIBundle\\Controller\\DefaultController::indexAction() was never imported.
...[语义错误] 方法 Ambry\\TumorNextAPIBundle\\Controller\\DefaultController::indexAction() 中的注释 \\"@Route\\" 从未被导入。 Did you maybe forget to add a \\"use\\" statement for this annotation?...
您是否忘记为此注释添加 \\"use\\" 语句?...
I was missing the following use statement(s):我错过了以下使用语句:
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
In the following code:在以下代码中:
<?php
namespace Ambry\TumorNextAPIBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Ambry\BioToolsBundle\Controller\ApplicationController;
class DefaultController extends ApplicationController
{
/**
* @Route("/", name="tumornext" )
* @Method({"GET","POST"})
* @Template
*/
public function indexAction(Request $request)
{
return array();
}
}
Lesson learned: Always check the log files.经验教训:始终检查日志文件。
tail -f app/logs/dev.log
tail -f app/logs/dev.log | grep CRIT
tail -f app/logs/dev.log | grep ERROR
tail -f app/logs/dev.log | grep INFO
In this case, you're missing use statement(s):在这种情况下,您缺少 use 语句:
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.