title: Symfony throwing ResourceNotFoundException with overridden error templates
body: <p>I have a small problem. I have already overridden the templates in <code>app/Resources/TwigBundle/views/Exception/</code> and have error, error404 and error500.html.twig respectively. <strong>I have deleted the cache</strong> and upon going on a undefined page I get:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'Symfony\Component\Routing\Exception\ResourceNotFoundException' in E:\svn\medapp\app\cache\prod\appProdUrlMatcher.php:4044 Stack trace: #0 E:\svn\medapp\app\cache\prod\classes.php(1433): appProdUrlMatcher->match('/asdasd') #1 E:\svn\medapp\app\cache\prod\classes.php(19616): Symfony\Component\Routing\Matcher\UrlMatcher->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #2 E:\svn\medapp\app\cache\prod\classes.php(2583): JMS\I18nRoutingBundle\Router\I18nRouter->matchRequest(Object(Symfony\Component\HttpFoundation\Request)) #3 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher)) #4 E:\svn\medapp\app\cache\prod\classes.php(2352): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDis in E:\svn\medapp\app\cache\prod\classes.php on line 5334
    503 Service Unavailable</p>
  </blockquote>
  
  <p>The prod.log:</p>
  
  <blockquote>
    <p>[2016-02-26 09:40:49] request.ERROR: Uncaught PHP Exception
    Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No
    route found for "GET /asdasdas"" at
    E:\svn\medapp\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\EventListener\RouterListener.php
    line 176 {"exception":"[object]
    (Symfony\Component\HttpKernel\Exception\NotFoundHttpException(code:
    0): No route found for \"GET /asdasdas\" at
    E:\svn\medapp\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\EventListener\RouterListener.php:176,
    Symfony\Component\Routing\Exception\ResourceNotFoundException(code:
    0):  at
    E:\svn\medapp\app\cache\prod\appProdUrlMatcher.php:4044)"} []
    [2016-02-26 09:40:49] request.CRITICAL: Exception thrown when handling
    an exception (Twig_Error_Runtime: An exception has been thrown during
    the rendering of a template ("The token storage contains no
    authentication token. One possible reason may be that there is no
    firewall configured for this URL.") in
    "MedAppBundle:Default:base.html.twig" at line 95. at
    E:\svn\medapp\vendor\twig\twig\lib\Twig\Template.php line 182)
    {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has
    been thrown during the rendering of a template (\"The token storage
    contains no authentication token. One possible reason may be that
    there is no firewall configured for this URL.\") in
    \"MedAppBundle:Default:base.html.twig\" at line 95. at
    E:\svn\medapp\vendor\twig\twig\lib\Twig\Template.php:182,
    Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException(code:
    0): The token storage contains no authentication token. One possible
    reason may be that there is no firewall configured for this URL. at
    E:\svn\medapp\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authorization\AuthorizationChecker.php:57)"}
    [] [2016-02-26 09:40:49] request.CRITICAL: Uncaught PHP Exception
    Twig_Error_Runtime: "An exception has been thrown during the rendering
    of a template ("The token storage contains no authentication token.
    One possible reason may be that there is no firewall configured for
    this URL.") in "MedAppBundle:Default:base.html.twig" at line 95." at
    E:\svn\medapp\vendor\twig\twig\lib\Twig\Template.php line 182
    {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has
    been thrown during the rendering of a template (\"The token storage
    contains no authentication token. One possible reason may be that
    there is no firewall configured for this URL.\") in
    \"MedAppBundle:Default:base.html.twig\" at line 95. at
    E:\svn\medapp\vendor\twig\twig\lib\Twig\Template.php:182,
    Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException(code:
    0): The token storage contains no authentication token. One possible
    reason may be that there is no firewall configured for this URL. at
    E:\svn\medapp\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authorization\AuthorizationChecker.php:57,
    Symfony\Component\HttpKernel\Exception\NotFoundHttpException(code:
    0): No route found for \"GET /asdasdas\" at
    E:\svn\medapp\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\EventListener\RouterListener.php:176,
    Symfony\Component\Routing\Exception\ResourceNotFoundException(code:
    0):  at
    E:\svn\medapp\app\cache\prod\appProdUrlMatcher.php:4044)"} []
    [2016-02-26 09:40:49] request.CRITICAL: Exception thrown when handling
    an exception (Twig_Error_Runtime: An exception has been thrown during
    the rendering of a template ("The token storage contains no
    authentication token. One possible reason may be that there is no
    firewall configured for this URL.") in
    "MedAppBundle:Default:base.html.twig" at line 95. at
    E:\svn\medapp\vendor\twig\twig\lib\Twig\Template.php line 182)
    {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has
    been thrown during the rendering of a template (\"The token storage
    contains no authentication token. One possible reason may be that
    there is no firewall configured for this URL.\") in
    \"MedAppBundle:Default:base.html.twig\" at line 95. at
    E:\svn\medapp\vendor\twig\twig\lib\Twig\Template.php:182,
    Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException(code:
    0): The token storage contains no authentication token. One possible
    reason may be that there is no firewall configured for this URL. at
    E:\svn\medapp\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authorization\AuthorizationChecker.php:57)"}
    []</p>
  </blockquote>
  
  <p>If I delete or rename the TwigBundle templates and then delete the cache, I get the standard Symfony error page:</p>
  
  <blockquote>
    <p>Oops! An Error Occurred</p>
    
    <p>The server returned a "404 Not Found".</p>
    
    <p>Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.</p>
  </blockquote>
  
  <p>What am I missing? </p>