schmittjoh / JMSSerializerBundle

Easily serialize, and deserialize data of any complexity (supports XML, JSON, YAML)
http://jmsyst.com/bundles/JMSSerializerBundle
MIT License
1.8k stars 311 forks source link

You have requested a non-existent service "jms_serializer.enum_subscriber" #935

Closed iceludek closed 11 months ago

iceludek commented 11 months ago
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? yes/no
product version
jms/serializer-bundle 5.3.1
symfony/symfony 3.4.49
FOSRestBundle not present
PHP 7.4.28
In ReplaceAliasByActualDefinitionPass.php line 57:

  [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]                                                          
  Unable to replace alias "jms_serializer.instance.default.enum_subscriber" with actual definition "jms_serializer.enum_subscriber".  

Exception trace:
  at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php:57
 Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass->process() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:140
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:789
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:643
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:135
 Symfony\Component\HttpKernel\Kernel->boot() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:64
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:27

In ContainerBuilder.php line 1060:

  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]   
  You have requested a non-existent service "jms_serializer.enum_subscriber".  

Exception trace:
  at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1060
 Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php:55
 Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass->process() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:140
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:789
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:643
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:135
 Symfony\Component\HttpKernel\Kernel->boot() at /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:64
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:27

After upgrading jms/serializer-bundle from ^4.0 to ^5.0, during clearing cache above error appears. I checked incrementally, on v5.0.0 there are the same errors but with other service: jms_serializer.symfony_uid_handler

Steps required to reproduce the problem

  1. bin/console cache:clear -vvv

Expected Result

Actual Result

iceludek commented 11 months ago

This was my internal issue with visibility of services. Found out creating a new project and building it with a configuration of not working one. After few hours I went through all the custom CompilerPasses ....