Problem/Motivation

Website runs on Drupal core 9.5.7 on a Raspberry PI-3. Following error can be found in the log after upgradi,ng the Components! module:

Error: Class "Drupal\components\Template\ComponentsInfo" not found in Drupal\Component\DependencyInjection\Container->createService() (regel 259 van /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php)

#0 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#1 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(434): Drupal\Component\DependencyInjection\Container->get()
#2 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#3 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#4 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(434): Drupal\Component\DependencyInjection\Container->get()
#5 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(273): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#6 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(449): Drupal\Component\DependencyInjection\Container->createService()
#7 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#8 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#9 /var/www/pi3.softpol.net/web/core/lib/Drupal.php(207): Drupal\Component\DependencyInjection\Container->get()
#10 /var/www/pi3.softpol.net/web/core/themes/engines/twig/twig.engine(47): Drupal::service()
#11 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template()
#12 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Theme\ThemeManager->render()
#13 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/Renderer.php(446): Drupal\Core\Render\Renderer->doRender()
#14 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#15 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#16 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#17 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#18 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#19 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#20 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#21 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#22 /var/www/pi3.softpol.net/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#23 /var/www/pi3.softpol.net/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#24 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#25 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#26 /var/www/pi3.softpol.net/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#27 /var/www/pi3.softpol.net/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /var/www/pi3.softpol.net/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#30 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#31 /var/www/pi3.softpol.net/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#32 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#33 /var/www/pi3.softpol.net/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#34 {main}

.

Steps to reproduce

pi@pi3:/var/www/pi3.softpol.net $ composer require 'drupal/components:^3.0@beta'
./composer.json has been updated
Running composer update drupal/components
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Upgrading drupal/components (2.4.0 => 3.0.0-beta3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Upgrading drupal/components (2.4.0 => 3.0.0-beta3): Extracting archive
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating autoload files
58 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

To bring the website back to service:

pi@pi3:/var/www/pi3.softpol.net $ composer require 'drupal/components:^2.4'
./composer.json has been updated
Running composer update drupal/components
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Downgrading drupal/components (3.0.0-beta3 => 2.4.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downgrading drupal/components (3.0.0-beta3 => 2.4.0): Extracting archive
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Generating autoload files
58 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

softpol created an issue. See original summary.

Sana.Neyazi’s picture

Facing the same issue with Components! 3.0.0-beta3 .

nicxvan’s picture

That service is no longer called. Did you run database updates and clear cache?
I just updated this module on one of the sites I manage, before running updates and clearing cache I got the same error.
After running db updates and clearing cache the site loads as expected.

Please confirm this works.

mefron’s picture

Wanted to chime in that I have the same issue. N.B. db updates/cache clear do not resolve the problem.

For context, this is running on a site using D9.5.7 as I prepare for migration to D10.

Actually, I realized that the error I'm seeing is different. The stacktrace looks like so:

Twig\Error\LoaderError: Template "@local_them/node/node.twig" is not defined in "themes/custom/local_theme/templates/content/node.html.twig" at line 7. in Twig\Loader\ChainLoader->getCacheKey() (line 98 of /var/www/html/vendor/twig/twig/src/Loader/ChainLoader.php).
Twig\Environment->getTemplateClass('@local_theme/node/node.twig', NULL) (Line: 205)
Drupal\Core\Template\TwigEnvironment->getTemplateClass('@local_theme/node/node.twig') (Line: 381)
Twig\Environment->loadTemplate('@local_theme/node/node.twig', NULL) (Line: 333)
Twig\Template->loadTemplate('@local_theme/node/node.twig', 'themes/custom/local_theme/templates/content/node.html.twig', 7) (Line: 42)
__TwigTemplate_760fb2f46136509b43e0877aee34af64->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/custom/local_theme/templates/content/node.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('node', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 243)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
softpol’s picture

I normally clear cache and update DB from the admin UI. This is not possible after upgrade to Components! 3.0.0-beta3, because the website is broken. So, I did the DB update with drush, but I got no system prompt back after 3 updates (and killed the proces with :

pi@pi3:/var/www/pi3.softpol.net $ vendor/bin/drush updatedb
------------ ---------------- ------------- ---------------------------------
Module Update ID Type Description
------------ ---------------- ------------- ---------------------------------
components components_reg post-update Clear caches to allow
istry_cache_pa components.registry service to
ths cache template paths.
components components_reg post-update Clear caches to load new
istry_service components.registry service.
components components_twi post-update Clear caches to load updated
g_loader_servi components.twig.loader service.
ce
------------ ---------------- ------------- ---------------------------------

Do you wish to run the specified pending updates? (yes/no) [yes]:
>

> [notice] Update started: components_post_update_components_registry_cache_paths
> [notice] Update completed: components_post_update_components_registry_cache_paths
> [notice] Update started: components_post_update_components_registry_service
> [notice] Update completed: components_post_update_components_registry_service
> [notice] Update started: components_post_update_components_twig_loader_service
> [notice] Update completed: components_post_update_components_twig_loader_service

^C

I then did a clear cache with drush:

pi@pi3:/var/www/pi3.softpol.net $ vendor/bin/drush cache-rebuild
[success] Cache rebuild complete.

and retried the DB update. AFter a long wait, I got a bunch of error messages, ending with:

PHP Fatal error: Uncaught Symfony\Component\Routing\Exception\RouteNotFoundException: Route "" does not exist. in /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Routing/RouteProvider.php:206
Stack trace:
#0 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(432): Drupal\Core\Routing\RouteProvider->getRouteByName()
#1 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(270): Drupal\Core\Routing\UrlGenerator->getRoute()
#2 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php(105): Drupal\Core\Routing\UrlGenerator->generateFromRoute()
#3 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Url.php(765): Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute()
#4 /var/www/pi3.softpol.net/web/modules/contrib/visitors/src/EventSubscriber/KernelTerminateSubscriber.php(152): Drupal\Core\Url->toString()
#5 [internal function]: Drupal\visitors\EventSubscriber\KernelTerminateSubscriber->onTerminate()
#6 /var/www/pi3.softpol.net/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#7 /var/www/pi3.softpol.net/vendor/symfony/http-kernel/HttpKernel.php(103): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#8 /var/www/pi3.softpol.net/vendor/stack/builder/src/Stack/StackedHttpKernel.php(32): Symfony\Component\HttpKernel\HttpKernel->terminate()
#9 /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/DrupalKernel.php(702): Stack\StackedHttpKernel->terminate()
#10 /var/www/pi3.softpol.net/vendor/drush/drush/src/Boot/DrupalBoot8.php(310): Drupal\Core\DrupalKernel->terminate()
#11 [internal function]: Drush\Boot\DrupalBoot8->terminate()
#12 {main}
thrown in /var/www/pi3.softpol.net/web/core/lib/Drupal/Core/Routing/RouteProvider.php on line 206

But eventually the website was again up…

I don't know if I applied the right commands, or in the right order. It would be good to add some additional instructions to the upgrade procedure.

nicxvan’s picture

That is documented here: https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-com...
Generally though you want to run drush updb first then clear cache.

Unfortunately what I suspect is happening is that the pi was just running out of memory trying to run the updates. I'm glad you were able to get it working though.

kreatil’s picture

I can confirm that. In my case running drush cr right after I had upgraded from Components 8.x-2.4 to version 3.0.0-beta3 broke the whole site und crashed its Docker container.

During a second attempt I ran drush updb before clearing the caches. This time I succeeded.

johnalbin’s picture

Category: Bug report » Support request
Status: Active » Fixed

I ran drush updb before clearing the caches.

Yep, that's the order you are supposed to do those operations when a module is updated.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.