Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to locate a schema at location #685

Closed
scasei opened this issue Feb 18, 2014 · 31 comments
Closed

Failed to locate a schema at location #685

scasei opened this issue Feb 18, 2014 · 31 comments

Comments

@scasei
Copy link

scasei commented Feb 18, 2014

at http://friendsofsymfony.github.io/schema/rest/ there is a
"404 - There isn't a GitHub Page here."
and symfony comes with:
failed to load external entity "in_memory_buffer"
when I do:
sonata_api_media:
type: rest
prefix: /api
resource: "@SonataMediaBundle/Resources/config/routing/api.xml"

@lsmith77
Copy link
Member

remove type: rest
that is only necessary if you want FOSRestBundle to auto discover the action methods, which you do not seem to want, since you are including an xml file with explicitly defined routes.

/cc @rande

@rande
Copy link

rande commented Feb 20, 2014

// cc @Bladrak

@scasei
Copy link
Author

scasei commented Feb 21, 2014

that may be right, but i have followed the instructions on how to setup up media rest api and got an error, so from my side of view one thing has to be changed: the instructions or the xmlns

@Bladrak
Copy link

Bladrak commented Feb 21, 2014

@lsmith77 here's the api.xml routing file:

<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://friendsofsymfony.github.com/schema/rest"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://friendsofsymfony.github.com/schema/rest https://raw.github.com/FriendsOfSymfony/FOSRestBundle/master/Resources/config/schema/routing/rest_routing-1.0.xsd">

    <import type="rest" resource="sonata.media.controller.api.gallery" name-prefix="sonata_api_media_gallery_" />
    <import type="rest" resource="sonata.media.controller.api.media" name-prefix="sonata_api_media_media_" />

</routes>

When we remove the type: rest from the main routing configuration, we get the following exception:

Cannot import resource "/web/Ekino/Sonata/src/sf2-sonata-sandbox/vendor/sonata-project/news-bundle/Resources/config/routing/api.xml" from "/web/Ekino/Sonata/src/sf2-sonata-sandbox/app/config/routing_api.yml". ([ERROR 1845] Element '{http://friendsofsymfony.github.com/schema/rest}routes': No matching global declaration available for the validation root. (in /web/Ekino/Sonata/src/sf2-sonata-sandbox/web/ - line 5, column 0))

Not sure where the problem is precisely, but I'm unable to reproduce @scasei's issue.

@scasei
Copy link
Author

scasei commented Feb 21, 2014

I followed the instruction on this page:
http://sonata-project.org/bundles/media/master/doc/reference/api.html
Then I tried to open the route '/api/doc' and got the error.
Should I grab more information?

Full error description:
FileLoaderLoadException: Cannot import resource "C:\wamp\www\project\vendor\sonata-project\media-bundle/Resources/config/routing/api.xml" from "C:/wamp/www/project/app/config\routing.yml". ([WARNING 1549] failed to load external entity "in_memory_buffer" (in n/a - line 0, column 0)
[WARNING 3084] Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'in_memory_buffer'. Skipping the import. (in in_memory_buffer - line 9, column 0)
[ERROR 1845] Element '{http://friendsofsymfony.github.com/schema/rest}routes': No matching global declaration available for the validation root. (in file:///C:/wamp/www/project/web/ - line 5, column 0))

@Bladrak
Copy link

Bladrak commented Feb 21, 2014

This path seems wrong in your log: C:/wamp/www/project/app/config\routing.yml; I'm not familiar enough with Windows to help you with that though...

I've noticed that there was an issue with an earlier version of Symfony (2.0.15 - cf symfony/symfony#4479). Any idea @lsmith77?

@scasei
Copy link
Author

scasei commented Feb 21, 2014

"This path seems wrong in your log": You mean the mixed slahes? Thats not a problem for windows PHP. Will be translated slightly.
Additionally the error occurs if I insert the 'sonata_api_media' route from instructions and disapear when I delete the route. (means that routing.yml will be found)

@Bladrak
Copy link

Bladrak commented Feb 21, 2014

Yep, that's what I meant. Ok then, didn't know about that.

I think the issue comes from the fact that you're unable to parse the http://friendsofsymfony.github.com/schema/rest XML schema definition that's at https://raw.github.com/FriendsOfSymfony/FOSRestBundle/master/Resources/config/schema/routing/rest_routing-1.0.xsd

I think we should wait for @lsmith77 insight about that. :)

@lsmith77
Copy link
Member

are you using the latest version of the Bundle?

@Bladrak
Copy link

Bladrak commented Feb 21, 2014

Our requirement for FOSRestBundle in SonataMediaBundle is "friendsofsymfony/rest-bundle": "~1.1". Should we require ~1.2 instead?

@lsmith77
Copy link
Member

~1.1 should be fine .. should use any 1.X release above 1.1

@lsmith77
Copy link
Member

@Tobion do you have a hint here?

@scasei
Copy link
Author

scasei commented Feb 21, 2014

from my composer.lock:

            "name": "friendsofsymfony/rest-bundle",
            "version": "1.2.2",
            "target-dir": "FOS/RestBundle",
            "source": {
                "type": "git",
                "url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git",
                "reference": "7c81a1879c5d8a3727932674509e96b2bb7a796e"
            },

@Tobion
Copy link
Member

Tobion commented Feb 23, 2014

Hm the errror looks rather strange. Where does "in_memory_buffer" come from? Can't see it referenced anywhere. Probably something internal to PHP. The only possible issue I see is that https://raw.github.com/FriendsOfSymfony/FOSRestBundle/master/Resources/config/schema/routing/rest_routing-1.0.xsd is sent with a text mime type instead of xml. So maybe that's the reason why it cannot be used for validation.

@scasei
Copy link
Author

scasei commented Feb 23, 2014

My server software signature:
Apache/2.2.26 (Win32) mod_ssl/2.2.26 OpenSSL/1.0.1e PHP/5.5.8

Is there something i could test or investigate?

@Tobion
Copy link
Member

Tobion commented Mar 12, 2014

Seems to be a php bug. See symfony/symfony#9731

@ghost
Copy link

ghost commented Apr 3, 2014

Up !
I followed every possible way to solve this issue, but I keep getting this error message :

[2/2] FileLoaderLoadException: Cannot import resource "C:\wamp\www\sandbox\vendor\sonata-project\news-bundle/Resources/config/routing/api.xml" from "C:/wamp/www/sandbox/app/config\routing_api.yml". ([WARNING 1549] failed to load external entity "in_memory_buffer" (in n/a - line 0, column 0)
[WARNING 3084] Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'in_memory_buffer'. Skipping the import. (in in_memory_buffer - line 9, column 0)
[ERROR 1845] Element '{http://friendsofsymfony.github.com/schema/rest}routes': No matching global declaration available for the validation root. (in file:///C:/wamp/www/sandbox/web/ - line 5, column 0))

Help!

@xabbuh
Copy link
Member

xabbuh commented Apr 3, 2014

@Soulaimaniya What do your api.xml and routing_api.yml files look like?

@ghost
Copy link

ghost commented Apr 3, 2014

This is my api.xml :

<import type="rest" resource="sonata.news.controller.api.post" name-prefix="sonata_api_news_post_" />
<import type="rest" resource="sonata.news.controller.api.comment" name-prefix="sonata_api_news_comment_" />

and this is how my routing_api.yml :

NelmioApiDocBundle:
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /doc

sonata_api_news:
type: rest
prefix: /news
resource: "@SonataNewsBundle/Resources/config/routing/api.xml"

sonata_api_media:
type: rest
prefix: /media
resource: "@SonataMediaBundle/Resources/config/routing/api.xml"

sonata_api_notification:
type: rest
prefix: /notification
resource: "@SonataNotificationBundle/Resources/config/routing/api.xml"

sonata_api_ecommerce_product:
type: rest
prefix: /ecommerce
resource: "@SonataProductBundle/Resources/config/routing/api.xml"

sonata_api_ecommerce_order:
type: rest
prefix: /ecommerce
resource: "@SonataOrderBundle/Resources/config/routing/api.xml"

sonata_api_ecommerce_invoice:
type: rest
prefix: /ecommerce
resource: "@SonataInvoiceBundle/Resources/config/routing/api.xml"

sonata_api_ecommerce_customer:
type: rest
prefix: /ecommerce
resource: "@SonataCustomerBundle/Resources/config/routing/api.xml"

sonata_api_ecommerce_basket:
type: rest
prefix: /ecommerce
resource: "@SonataBasketBundle/Resources/config/routing/api.xml"

sonata_api_page:
type: rest
prefix: /page
resource: "@SonataPageBundle/Resources/config/routing/api.xml"

sonata_api_user:
type: rest
prefix: /user
resource: "@SonataUserBundle/Resources/config/routing/api.xml"

I've tried every single instruction, everything fails.

@Tobion
Copy link
Member

Tobion commented Apr 3, 2014

It should be fixed by symfony/symfony#10493 which is in v2.3.12. Can you update symfony in your project and try again?

@ghost
Copy link

ghost commented Apr 3, 2014

is there a cmd to upgrade symfony ? mine is v2.3.11

@Tobion
Copy link
Member

Tobion commented Apr 3, 2014

composer.phar update symfony/symfony

@ghost
Copy link

ghost commented Apr 3, 2014

updated to symfony 2.3.12, same error.

@Tobion
Copy link
Member

Tobion commented Apr 3, 2014

You also need to restart php fpm to reset the system.

Issues described that only a restart of php-fpm solves the error.

@fabricek
Copy link
Contributor

fabricek commented Apr 9, 2014

same error in Symfony version 2.5 somebody has solved it ? Maybe the beautifull Soulaimaniya ?

@fabricek
Copy link
Contributor

The solution


I remove the bundle Fos rest in the vendor folder \vendor\friendsofsymfony\rest-bundle
and replace in composer.json "friendsofsymfony / rest-bundle": "1.1.*" instead of "~ 1.1". Make an composer update and no more error.

@fabricek
Copy link
Contributor

The problem is only in windows (wamp for me). I ll try on a debian machine with success. I don't know how to solve it in windows. It s a fos/rest problem with a fos/restbundle version above 1.1.* on windows only.

@fabricek
Copy link
Contributor

the problem is finally solved. and i made a pr. #744 and read #739

lsmith77 added a commit that referenced this issue Apr 13, 2014
 Failed to locate a schema at location #685 #739 The Tests are red/failu...
@lyzkov
Copy link

lyzkov commented Jun 2, 2014

I have the same error:

[ERROR 1845] Element '{http://friendsofsymfony.github.com/schema/rest}route  
  s': No matching global declaration available for the validation root.

composer.json:

        "symfony/symfony": "~2.4",
        "friendsofsymfony/rest-bundle": "1.3.*",

PHP 5.5.11
OSX 10.9.3

My routing.xml file:

<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://friendsofsymfony.github.com/schema/rest"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://friendsofsymfony.github.com/schema/rest https://raw.github.com/FriendsOfSymfony/FOSRestBundle/master/Resources/config/schema/routing/rest_routing-1.0.xsd">
</routes>

@lsmith77
Copy link
Member

lsmith77 commented Jun 2, 2014

can you try current master?

@lyzkov
Copy link

lyzkov commented Jun 2, 2014

dev-master is working like a charm. :)

2014-06-02 13:29 GMT+02:00 Lukas Kahwe Smith notifications@github.com:

can you try current master?


Reply to this email directly or view it on GitHub
#685 (comment)
.

Pozdrawiam,
Piotr Łyczba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants