Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony: InvalidArgumentException while parsing web.xml

Recently I moved a Symfony-system to another Server and got an error ever since. The technical details are: An apache 2.4 server on a windows server 2012 A fileserver which can be accessed by apache over the local network

When I moved the Symfony-page I deleted the cache. What happens now is, that I get these error-messages:

InvalidArgumentException: Unable to parse file "\\FILESERVER\PAGEPATH\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\DependencyInjection/../Resources/config\web.xml".

and

InvalidArgumentException: [WARNING 1549] failed to load external entity "file://///FILESERVER/PAGEPATH/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd" (in n/a - line 0, column 0)
[WARNING 3084] Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'file://///FILESERVER/PAGEPATH/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd'. Skipping the import. (in in_memory_buffer - line 8, column 0)
[ERROR 1845] Element '{http://symfony.com/schema/dic/services}container': No matching global declaration available for the validation root. (in //FILESERVER/PAGEPATH/web/ - line 5, column 0)

What seems to be the problem, that in the first error, there is a mixture of slashes and backslashes in the path but I have no idea how to fix this issue.

like image 923
Friedrich Avatar asked Mar 03 '15 16:03

Friedrich


2 Answers

This issue is due to using UNC path (\\something). I had the same problem in Windows network enviroment with IIS and Symfony on another server. Unfortunatelly, I wasn't able to find solution. I ended up with having source code on the same machine and using local path.

EDIT: I found one more possible solution - symbolic link.

mklink /d C:\myroot \\FILESERVER\PAGEPATH

Now you can see under C:\myroot content of shared folder. I don't know if Apache will be happy with it but IIS doesn't have problem. And one more thing, be prepared for some performance issues due to network transfer.

like image 184
kba Avatar answered Oct 05 '22 03:10

kba


I am not sure whether this is related to your problem, but I once experienced problems parsing XML files when the schema definition file could not be loaded at parse time. The parser tried to load the XML schema file via network and in case the network connection failed, parsing the XML file failed as well.

If you are in production, for performance reasons you might not want a schema validation at all, so check whether the used parser offers a way to turn the automatic schema validation off. If however the error occurs in your development workflow, make sure that the schema URLs can actually be resolved from the webserver that parses the XML file.

like image 27
Fabian Keller Avatar answered Oct 05 '22 03:10

Fabian Keller