framework: Uncaught Error: Class 'Doctrine\Common\Annotations\AnnotationReader' not found
Hello, I’m trying to use Go in a project, but it’s crashing out of the box. It seems strange to me because I would think a crash this basic would affect more people. Perhaps it’s my environment. I added some print debugging to the composer ClassLoader and the AopComposerLoader. As you can see it successfully locates the files on disk and includes them, but in the case of the doctrine AnnotationReader it tries to apply the go.source.transforming.loader filter and crashes the program.
Searching for class Symfony\Component\Console\Application with extension .php File path before rewrite: /root/git/project/vendor/composer/../symfony/console/Application.php File path after rewrite: php://filter/read=go.source.transforming.loader/resource=/root/git/project/vendor/composer/../symfony/console/Application.php Searching for class Go\Instrument\Transformer\StreamMetaData with extension .php File path before rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Instrument/Transformer/StreamMetaData.php File path after rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Instrument/Transformer/StreamMetaData.php Including /root/git/project/vendor/composer/../goaop/framework/src/Instrument/Transformer/StreamMetaData.php Searching for class Go\Instrument\Transformer\WeavingTransformer with extension .php File path before rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Instrument/Transformer/WeavingTransformer.php File path after rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Instrument/Transformer/WeavingTransformer.php Including /root/git/project/vendor/composer/../goaop/framework/src/Instrument/Transformer/WeavingTransformer.php Searching for class Go\Core\AdviceMatcher with extension .php File path before rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Core/AdviceMatcher.php File path after rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Core/AdviceMatcher.php Including /root/git/project/vendor/composer/../goaop/framework/src/Core/AdviceMatcher.php Searching for class Go\Core\AspectLoader with extension .php File path before rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Core/AspectLoader.php File path after rewrite: /root/git/project/vendor/composer/../goaop/framework/src/Core/AspectLoader.php Including /root/git/project/vendor/composer/../goaop/framework/src/Core/AspectLoader.php Searching for class Doctrine\Common\Annotations\AnnotationReader with extension .php File path before rewrite: /root/git/project/vendor/composer/../doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php File path after rewrite: php://filter/read=go.source.transforming.loader/resource=/root/git/project/vendor/composer/../doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php PHP Fatal error: Uncaught Error: Class 'Doctrine\Common\Annotations\AnnotationReader' not found in /root/git/project/vendor/goaop/framework/src/Core/GoAspectContainer.php:88 Stack trace: #0 /root/git/project/vendor/goaop/framework/src/Core/Container.php(65): Go\Core\GoAspectContainer->Go\Core{closure}(Object(Go\Core\GoAspectContainer)) #1 /root/git/project/vendor/goaop/framework/src/Core/Container.php(87): Go\Core\Container->Go\Core{closure}(Object(Go\Core\GoAspectContainer)) #2 /root/git/project/vendor/goaop/framework/src/Core/GoAspectContainer.php(50): Go\Core\Container->get('aspect.annotati...') #3 /root/git/project/vendor/goaop/framework/src/Core/Container.php(65): Go\Core\GoAspectContainer->Go\Core{closure}(Object(Go\Core\GoAspectContainer)) #4 /root/git/project/vendor/goaop/framework/src/Core/Container.php(87): Go\Core\Container->Go\Core{closure}(Object(Go\Core\GoAspectContainer)) #5 /root/git/project/vendor/goaop/framework/src/Core/GoAspectContai in /root/git/project/vendor/goaop/framework/src/Core/GoAspectContainer.php on line 88
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 28 (20 by maintainers)
Hi, @shiva-050865
This issue is typically occurs when AOP framework tries to intercept it’s own classes (you should check that vendor dir is excluded from processing). You can try to add
vendordir to theexcludePathsoption for the kernel.Unfortunately, I tried to rewrite this part of code several times, but it’s very tricky and I haven’t succeeded yet. Maybe for v3.0 it will work without excluding framework’s core libraries directories automatically.
Could you also show me the config for initialization, especially appDir, includePaths and excludePaths for your app.
Maybe you just include vendor libraries too? Not only the src folder of your app? In this case AOP will try to intercept and analyze itself and will definitely crash. To solve this, just add vendor directory to the excludePaths option.