Symfony: InvalidArgumentException while parsing web.xml
Asked Answered
A

3

7

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.

Admass answered 3/3, 2015 at 16:4 Comment(3)
seem stupid but.... can you try this solutions?Ambroid
Rebooting the computer? Yes, I've tried this.Admass
I've updated my answer. Hope that helps.Pappus
P
2

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.

Pappus answered 4/3, 2015 at 15:10 Comment(2)
Apache does not like this.Admass
How about FollowSymlinks option in you apache configuration? Have you configured it?Pappus
L
1

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.

Luben answered 12/3, 2015 at 20:42 Comment(0)
A
0

If the UNC path is the problem, maybe it works if you map the network share to a local drive and use the paths on the local drive to access the application.

Map \\FILESERVER\PAGEPATH to a local drive, let's say W: (W from web) then configure Apache's web root to W:\web instead of \\FILESERVER\PAGEPATH\web. I guess all the other path references are relative and nothing else needs to be changed.

(just a thought)

Update:

As a regular user, you can map a network share as a local drive and have it automatically re-connect on each logon by using the following command line:

C:\> net use W: \\FILESERVER\PAGEPATH /persistent:yes

Apache doesn't run as a regular user (I don't have a Windows system at hand but I think it runs as SYSTEM USER). I cannot tell if the special users "logs on" when Windows starts up.

However, I think it is possible to run the command above (stored in a .cmd file) using the Task Scheduler (on Windows 7 or newer), every time Windows starts.

Antoinetteanton answered 6/3, 2015 at 13:29 Comment(4)
If there is possibility to mount this drive at windows startup without need of user login it could work.Pappus
I don't have a Windows system at hand (didn't work on Windows since 3 years ago) but as far as I can remember the net command line can be used to mount shared folders. Check this article: microsoft.com/resources/documentation/windows/xp/all/proddocs/… for switches.Antoinetteanton
Hmm... the connections are restored at logon. Apache doesn't run as a regular user, I guess it doesn't logon. :-(Antoinetteanton
Apache wont handle this, even though the user which runs the service which runs Apache has the mapped drive.Admass

© 2022 - 2024 — McMap. All rights reserved.