Fosuserbundle: Invalid mapping file 'FOS.UserBundle.Model.User.orm.xml'

Created on 15 Mar 2016  路  4Comments  路  Source: FriendsOfSymfony/FOSUserBundle

After i update my bundles with composer since few days i get blank screen on my website. Everytime i get blank screen prod.log file tells me this. But user login and signup works without problem.

When I reload/restart php-fpm service, my website start to work as expected. After few hours, it get blank again.

I have no idea why this is happening. Do you guys have any idea? Or how can I know exactly where this problem comes. Current stack trace is not helpful.

I have regularly restart php-fpm to work.

Note: I am using Symfony 2.8.0 with FOSUserBundle (dev-master)

error.php.log (php-fpm log):

`Next exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'Invalid mapping file 'FOS.UserBundle.Model.User.orm.xml' for class 'FOS\UserBundle\Model\User'.' in /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:86
Stack trace:

0 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php(117): Doctrine\Common\Persistence\Mapping\MappingException::invalidMappingFile('FOS\UserBundle...', 'FOS.UserBundle....')

1 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php(58): Doctrine\Common\Persistence\Mapping\Driver\FileDriver->getElement('FOS\UserBundle...')

2 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php(102): Doctrine\ORM\Mapping\Driver\XmlDriver->loadMetadataForClass('FOS\UserBundle...', Object(Doctrine\ORM\Mapping\ClassMetadata))

3 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(151): Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass('FOS\UserBundle...', Object(Doctrine\ORM\Mapping\ClassMetadata))

4 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(332): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array)

5 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(78): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('Arc\StoreBundle...')

6 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(216): Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata('Arc\StoreBundle...')

7 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(281): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('Arc\StoreBundle...')

8 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php(44): Doctrine\ORM\EntityManager->getClassMetadata('Arc\StoreBundle...')

9 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(698): Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository(Object(Doctrine\ORM\EntityManager), 'Arc\StoreBundle...')

10 /www/sample.com/app/cache/prod/appProdProjectContainer.php(365): Doctrine\ORM\EntityManager->getRepository('Arc\StoreBundle...')

11 /www/sample.com/app/bootstrap.php.cache(2182): appProdProjectContainer->get in /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php on line 86

[15-Mar-2016 15:50:06 Europe/Istanbul] PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "/www/sample.com/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping/User.orm.xml" in /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 814`

prod.log

[2016-03-15 15:45:35] php.CRITICAL: Fatal Error: Uncaught exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'Invalid mapping file 'FOS.UserBundle.Model.User.orm.xml' for class 'FOS\UserBundle\Model\User'.' in /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:86 Stack trace: #0 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php(117): Doctrine\Common\Persistence\Mapping\MappingException::invalidMappingFile('FOS\\UserBundle\\...', 'FOS.UserBundle....') #1 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php(58): Doctrine\Common\Persistence\Mapping\Driver\FileDriver->getElement('FOS\\UserBundle\\...') #2 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php(102): Doctrine\ORM\Mapping\Driver\XmlDriver->loadMetadataForClass('FOS\\UserBundle\\...', Object(Doctrine\ORM\Mapping\ClassMetadata)) #3 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(151): Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass('FOS\\UserBundle\\...', Object(Doctrine\ORM\Mapping\ClassMetadata)) #4 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(332): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array) #5 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(78): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('Arc\\StoreBundle...') #6 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(216): Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata('Arc\\StoreBundle...') #7 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(281): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('Arc\\StoreBundle...') #8 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php(44): Doctrine\ORM\EntityManager->getClassMetadata('Arc\\StoreBundle...') #9 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(698): Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository(Object(Doctrine\ORM\EntityManager), 'Arc\\StoreBundle...') #10 /www/sample.com/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php(40): Doctrine\ORM\EntityManager->getRepository('Arc\\StoreBundle...') #11 /www/sample.com/app/cache/prod/appProdProjectContainer.php(884): FOS\UserBundle\Doctrine\UserManager->__construct(Object(Symfony\Component\Security\Core\Encoder\EncoderFactory), Object(FOS\UserBundle\Util\Canonicalizer), Object(FOS\UserBundle\Util\Canonicalizer), Object(Doctrine\ORM\EntityManager), 'Arc\\StoreBundle...') #12 /www/sample.com/app/bootstrap.php.cache(2182): appProdProjectContainer->getFosUser_UserManagerService() #13 /www/sample.com/app/cache/prod/appProdProjectContainer.php(1885): Symfony\Component\DependencyInjection\Container->get('fos_user.user_m...') #14 /www/sample.com/app/bootstrap.php.cache(2182): appProdProjectContainer->getApp_UserProvider_EmailService() #15 /www/sample.com/app/cache/prod/appProdProjectContainer.php(1413): Symfony\Component\DependencyInjection\Container->get('app.user_provid...') #16 /www/sample.com/app/bootstrap.php.cache(2182): appProdProjectContainer->getSecurity_Firewall_Map_Context_MainService() #17 /www/sample.com/app/cache/prod/classes.php(1267): Symfony\Component\DependencyInjection\Container->get('security.firewa...') #18 /www/sample.com/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall.php(61): Symfony\Bundle\SecurityBundle\Security\FirewallMap->getListeners(Object(Symfony\Component\HttpFoundation\Request)) #19 [internal function]: Symfony\Component\Security\Http\Firewall->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher)) #20 /www/sample.com/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(181): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher)) #21 /www/sample.com/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'kernel.request', Object(Symfony\Component\HttpKernel\Event\GetResponseEvent)) #22 /www/sample.com/app/bootstrap.php.cache(2671): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', Object(Symfony\Component\HttpKernel\Event\GetResponseEvent)) #23 /www/sample.com/app/bootstrap.php.cache(2644): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #24 /www/sample.com/app/bootstrap.php.cache(2795): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /www/sample.com/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(185): Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /www/sample.com/web/app.php(64): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #27 {main} Next exception 'Doctrine\Common\Persistence\Mapping\MappingException' with message 'Invalid mapping file 'FOS.UserBundle.Model.User.orm.xml' for class 'FOS\UserBundle\Model\User'.' in /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:86 Stack trace: #0 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php(117): Doctrine\Common\Persistence\Mapping\MappingException::invalidMappingFile('FOS\\UserBundle\\...', 'FOS.UserBundle....') #1 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php(58): Doctrine\Common\Persistence\Mapping\Driver\FileDriver->getElement('FOS\\UserBundle\\...') #2 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php(102): Doctrine\ORM\Mapping\Driver\XmlDriver->loadMetadataForClass('FOS\\UserBundle\\...', Object(Doctrine\ORM\Mapping\ClassMetadata)) #3 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(151): Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass('FOS\\UserBundle\\...', Object(Doctrine\ORM\Mapping\ClassMetadata)) #4 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(332): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array) #5 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(78): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('Arc\\StoreBundle...') #6 /www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(216): Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata('Arc\\StoreBundle...') #7 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(281): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('Arc\\StoreBundle...') #8 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/Repository/DefaultRepositoryFactory.php(44): Doctrine\ORM\EntityManager->getClassMetadata('Arc\\StoreBundle...') #9 /www/sample.com/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(698): Doctrine\ORM\Repository\DefaultRepositoryFactory->getRepository(Object(Doctrine\ORM\EntityManager), 'Arc\\StoreBundle...') #10 /www/sample.com/app/cache/prod/appProdProjectContainer.php(365): Doctrine\ORM\EntityManager->getRepository('Arc\\StoreBundle...') #11 /www/sample.com/app/bootstrap.php.cache(2182): appProdProjectContainer->get {"type":1,"file":"/www/sample.com/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php","line":86,"level":6135,"stack":[]} []

Most helpful comment

Running Phabricator on the same server is indeed the problem. You can get around this by modifying the app.php or app_dev.php files in the web directory.

At the top of app.php, immediately after your namespace imports, you can add the following code to resolve the issue:

libxml_disable_entity_loader(false);

All 4 comments

Did you try this?

  1. rm -rf ./vendor/
  2. composer self-update
  3. composer update

Are you sure that you use dev-master version?

I am using ~2.0@dev

I did what you suggested. Lets see what will happen in a day.

Allright. Situation here.

Fact is, this is not related to this bundle nor PHP nor anything else. It is related to phabricator. I use phabricator app on my server and because of this app i suddenly get this error. I tried 3 different servers with different paths and configs. With or without phabricator. All phabricator instances has this issue. If i stop and block phabricator, PHP apps works normally. Something is wrong with phabricator.

I close this issue.

Running Phabricator on the same server is indeed the problem. You can get around this by modifying the app.php or app_dev.php files in the web directory.

At the top of app.php, immediately after your namespace imports, you can add the following code to resolve the issue:

libxml_disable_entity_loader(false);

Was this page helpful?
0 / 5 - 0 ratings