1
votes

I have a symfony 3.3 application deployed to a shared hosting, when accessing any url of the application i got this error:

[2018-01-17 21:54:24] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Config\Exception\FileLoaderLoadException: "[Semantical Error] The annotation "@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route" in class AppBundle\Controller\ConventionAccommodationController does not exist, or could not be auto-loaded in /usr/home/convenciones.bookingarea.com/web/src/AppBundle/Controller/ (which is being imported from "/usr/home/convenciones.bookingarea.com/web/app/config/routing.yml"). Make sure annotations are enabled." at /usr/home/convenciones.bookingarea.com/web/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php

line 168 {"exception":"[object] (Symfony\Component\Config\Exception\FileLoaderLoadException(code: 0): [Semantical Error] The annotation \"@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route\" in class AppBundle\Controller\ConventionAccommodationController does not exist, or could not be auto-loaded in /usr/home/convenciones.bookingarea.com/web/src/AppBundle/Controller/ (which is being imported from \"/usr/home/convenciones.bookingarea.com/web/app/config/routing.yml\"). Make sure annotations are enabled. at /usr/home/convenciones.bookingarea.com/web/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php:168,

Doctrine\Common\Annotations\AnnotationException(code: 0): [Semantical Error] The annotation \"@Sensio\Bundle\FrameworkExtraBundle\Configuration\Route\" in class AppBundle\Controller\ConventionAccommodationController does not exist, or could not be auto-loaded. at /usr/home/convenciones.bookingarea.com/web/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54)"} []

Be aware that i am not able to execute composer.phar in the shared machine so i have to launch install and dump-autoload commands at my local machine and rsync vendor and var/bootstrap.php.cache of my machine with the production server directory.

This code and configuration works without problems in local develop machines and a staging server at Rackspace but throws the FileLoaderLoadException in the shared hosting for production.

I have disabled opcache and apc in the production server to discard php accelerator issues. That change do not solve the issue.

#app/config/routing.yml

app:
    resource: '@AppBundle/Controller/'
    type: annotation

#src/AppBundle/Controller/ConventionAccommodationController

<?php

namespace AppBundle\Controller;

use AppBundle\Entity\Sala;
use AppBundle\Entity\Hotel;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
.....

$ ls vendor/sensio/framework-extra-bundle/Configuration/
Cache.php            Method.php      Security.php
ConfigurationAnnotation.php  ParamConverter.php  Template.php
ConfigurationInterface.php   Route.php

thanks a lot any clue welcomed.

1
I face exactly the same issue...Jérôme Verstrynge

1 Answers

1
votes

I have just managed to solve this with composer clearcache followed by composer update.