Symfony Exception

ClassNotFoundError

HTTP 500 Internal Server Error

Attempted to load class "NotFoundHttpException" from namespace "App\EventListener".
Did you forget a "use" statement for "Symfony\Component\HttpKernel\Exception\NotFoundHttpException"?

Exception

Symfony\Component\ErrorHandler\Error\ ClassNotFoundError

  1.             if ($page != NULL) {
  2.                 $this->getRubriquePrincipal($page);
  3.                 $this->twig->addGlobal("page"$page);
  4.                 $this->twig->addGlobal("fileAriane"array_reverse($this->fileAriane));
  5.             }else{
  6.                 throw new NotFoundHttpException(nullnull404);
  7.             }
  8.         }
  9.     }
  10.     /**
BaseListener->setPageContext() in /home/otideap/www/sudcms/src/EventListener/BaseListener.php (line 423)
  1.             $this->twig->addGlobal("ecoCategs"$repoCategs->findByEcoCategories());
  2.             $this->twig->addGlobal("actualiteCategs"$actualiteCategsRepo->findByCategoriesActu(array('site_lang' => $this->langue'site_uid' => $site_id)));
  3.             $this->navigationLoaded true;
  4.         }
  5.         //Cas d'une page interne (chargement de l'environnement d'une page pour un controller)
  6.         $this->setPageContext();
  7.         //display popup from everywhere
  8.         $this->displayPopup();
  9.     }
BaseListener->LoadFrontRessourcesEcommerce(1) in /home/otideap/www/sudcms/src/EventListener/BaseListener.php (line 150)
  1. //        } else {
  2. //            $this->LoadFrontRessources($this->params->get('SITE_ID')); //Site 1
  3. //        }
  4.             //FRONT ECOMMERCE
  5.         } else {
  6.             $this->LoadFrontRessourcesEcommerce($this->params->get('SITE_ID')); //Site 1
  7.         }
  8.         // manage the newsletter registration
  9.         if ($event->getRequest()->get("mailNL") && $event->getRequest()->get("accpetRecNL") == 1) {
  1.         $this->called true;
  2.         $this->priority $dispatcher->getListenerPriority($eventName$this->listener);
  3.         $e $this->stopwatch->start($this->name'event_listener');
  4.         ($this->optimizedListener ?? $this->listener)($event$eventName$dispatcher);
  5.         if ($e->isStarted()) {
  6.             $e->stop();
  7.         }
  1.         foreach ($listeners as $listener) {
  2.             if ($stoppable && $event->isPropagationStopped()) {
  3.                 break;
  4.             }
  5.             $listener($event$eventName$this);
  6.         }
  7.     }
  8.     /**
  9.      * Sorts the internal list of listeners for the given event by priority.
  1.         } else {
  2.             $listeners $this->getListeners($eventName);
  3.         }
  4.         if ($listeners) {
  5.             $this->callListeners($listeners$eventName$event);
  6.         }
  7.         return $event;
  8.     }
  1.         try {
  2.             $this->beforeDispatch($eventName$event);
  3.             try {
  4.                 $e $this->stopwatch->start($eventName'section');
  5.                 try {
  6.                     $this->dispatcher->dispatch($event$eventName);
  7.                 } finally {
  8.                     if ($e->isStarted()) {
  9.                         $e->stop();
  10.                     }
  11.                 }
  1.     {
  2.         $this->requestStack->push($request);
  3.         // request
  4.         $event = new RequestEvent($this$request$type);
  5.         $this->dispatcher->dispatch($eventKernelEvents::REQUEST);
  6.         if ($event->hasResponse()) {
  7.             return $this->filterResponse($event->getResponse(), $request$type);
  8.         }
  1.     public function handle(Request $requestint $type HttpKernelInterface::MAIN_REQUESTbool $catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $exception $event->getThrowable();
  2.         $request $this->duplicateRequest($exception$event->getRequest());
  3.         try {
  4.             $response $event->getKernel()->handle($requestHttpKernelInterface::SUB_REQUESTfalse);
  5.         } catch (\Exception $e) {
  6.             $f FlattenException::createFromThrowable($e);
  7.             $this->logException($esprintf('Exception thrown when handling an exception (%s: %s at %s line %s)'$f->getClass(), $f->getMessage(), $e->getFile(), $e->getLine()));
  1.         $this->called true;
  2.         $this->priority $dispatcher->getListenerPriority($eventName$this->listener);
  3.         $e $this->stopwatch->start($this->name'event_listener');
  4.         ($this->optimizedListener ?? $this->listener)($event$eventName$dispatcher);
  5.         if ($e->isStarted()) {
  6.             $e->stop();
  7.         }
  1.         foreach ($listeners as $listener) {
  2.             if ($stoppable && $event->isPropagationStopped()) {
  3.                 break;
  4.             }
  5.             $listener($event$eventName$this);
  6.         }
  7.     }
  8.     /**
  9.      * Sorts the internal list of listeners for the given event by priority.
  1.         } else {
  2.             $listeners $this->getListeners($eventName);
  3.         }
  4.         if ($listeners) {
  5.             $this->callListeners($listeners$eventName$event);
  6.         }
  7.         return $event;
  8.     }
  1.         try {
  2.             $this->beforeDispatch($eventName$event);
  3.             try {
  4.                 $e $this->stopwatch->start($eventName'section');
  5.                 try {
  6.                     $this->dispatcher->dispatch($event$eventName);
  7.                 } finally {
  8.                     if ($e->isStarted()) {
  9.                         $e->stop();
  10.                     }
  11.                 }
  1.      * @throws \Exception
  2.      */
  3.     private function handleThrowable(\Throwable $eRequest $requestint $type): Response
  4.     {
  5.         $event = new ExceptionEvent($this$request$type$e);
  6.         $this->dispatcher->dispatch($eventKernelEvents::EXCEPTION);
  7.         // a listener might have replaced the exception
  8.         $e $event->getThrowable();
  9.         if (!$event->hasResponse()) {
  1.     {
  2.         if (!$request $request ?: $this->requestStack->getMainRequest()) {
  3.             throw $exception;
  4.         }
  5.         $response $this->handleThrowable($exception$requestself::MAIN_REQUEST);
  6.         $response->sendHeaders();
  7.         $response->sendContent();
  8.         $this->terminate($request$response);
  1.                         if ($hasRun) {
  2.                             throw $e;
  3.                         }
  4.                         $hasRun true;
  5.                         $kernel->terminateWithException($e$request);
  6.                     };
  7.                 }
  8.             } elseif ($event instanceof ConsoleEvent && $app $event->getCommand()->getApplication()) {
  9.                 $output $event->getOutput();
  10.                 if ($output instanceof ConsoleOutputInterface) {
in /home/otideap/www/sudcms/vendor/symfony/error-handler/ErrorHandler.php :: Symfony\Component\HttpKernel\EventListener\{closure} (line 607)
  1.             $this->exceptionHandler null;
  2.         }
  3.         try {
  4.             if (null !== $exceptionHandler) {
  5.                 return $exceptionHandler($exception);
  6.             }
  7.             $handlerException $handlerException ?: $exception;
  8.         } catch (\Throwable $handlerException) {
  9.         }
  10.         if ($exception === $handlerException && null === $this->exceptionHandler) {
ErrorHandler->handleException(object(ClassNotFoundError))

Stack Trace

ClassNotFoundError
Symfony\Component\ErrorHandler\Error\ClassNotFoundError:
Attempted to load class "NotFoundHttpException" from namespace "App\EventListener".
Did you forget a "use" statement for "Symfony\Component\HttpKernel\Exception\NotFoundHttpException"?

  at /home/otideap/www/sudcms/src/EventListener/BaseListener.php:568
  at App\EventListener\BaseListener->setPageContext()
     (/home/otideap/www/sudcms/src/EventListener/BaseListener.php:423)
  at App\EventListener\BaseListener->LoadFrontRessourcesEcommerce(1)
     (/home/otideap/www/sudcms/src/EventListener/BaseListener.php:150)
  at App\EventListener\BaseListener->onKernelRequest(object(RequestEvent), 'kernel.request', object(TraceableEventDispatcher))
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(RequestEvent), 'kernel.request', object(TraceableEventDispatcher))
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/EventDispatcher.php:230)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(RequestEvent))
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/EventDispatcher.php:59)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(RequestEvent), 'kernel.request')
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(RequestEvent), 'kernel.request')
     (/home/otideap/www/sudcms/vendor/symfony/http-kernel/HttpKernel.php:132)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 2)
     (/home/otideap/www/sudcms/vendor/symfony/http-kernel/HttpKernel.php:78)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 2, false)
     (/home/otideap/www/sudcms/vendor/symfony/http-kernel/EventListener/ErrorListener.php:60)
  at Symfony\Component\HttpKernel\EventListener\ErrorListener->onKernelException(object(ExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(ExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/EventDispatcher.php:230)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(ExceptionEvent))
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/EventDispatcher.php:59)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
     (/home/otideap/www/sudcms/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
     (/home/otideap/www/sudcms/vendor/symfony/http-kernel/HttpKernel.php:217)
  at Symfony\Component\HttpKernel\HttpKernel->handleThrowable(object(ClassNotFoundError), object(Request), 1)
     (/home/otideap/www/sudcms/vendor/symfony/http-kernel/HttpKernel.php:110)
  at Symfony\Component\HttpKernel\HttpKernel->terminateWithException(object(ClassNotFoundError), object(Request))
     (/home/otideap/www/sudcms/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:129)
  at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener\{closure}(object(ClassNotFoundError))
     (/home/otideap/www/sudcms/vendor/symfony/error-handler/ErrorHandler.php:607)
  at Symfony\Component\ErrorHandler\ErrorHandler->handleException(object(ClassNotFoundError))