首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Symfony2.0 - InvalidArgumentException

Symfony2.0 - InvalidArgumentException
EN

Stack Overflow用户
提问于 2014-01-14 09:46:03
回答 2查看 5.1K关注 0票数 0

我在symfony 2.3上有点麻烦,我希望你能帮我解决这个问题。

我真的不知道我做错了什么,但突然之间,我得到了这些错误,现在我无法摆脱它们。

错误1:

代码语言:javascript
复制
InvalidArgumentException: [WARNING 1549] failed to load external entity "file:///C:/wamp/www/Symfony/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:///C:/wamp/www/Symfony/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 file:///C:/wamp/www/Symfony/web/ - line 5, column 0)

Error2:

代码语言:javascript
复制
InvalidArgumentException: Unable to parse file "C:\wamp\www\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\DependencyInjection/../Resources/config\web.xml".

我试图删除我认为导致这些错误的内容(我也试图清理缓存),但这些都没有效果。

我猜想我一定是在一个小树枝或xlf文件中出错了,因为这些错误是在我只修改了那些文件之后出现的,但是我无法发现我在这些文件中做错了什么(对我来说,我所做的一切看起来都很好)。

如果你们需要的话我可以把文件寄出去。

编辑:

小枝档案:

代码语言:javascript
复制
{%  extends '::base.html.twig' %}

{% block title %}{{ 'myAccount'|trans }}{% endblock %}
{% block stylesheets %}
    {{ parent() }}
    <link href="{{ asset('bundles/account/css/myProfile.css') }}" rel="stylesheet">
{% endblock %}
{% block content %}
<div class="profile-hor-nav">
    <ul class="nav nav-pills profile-menu-font">
        <li class="active profile-hor-nav-element">
            <a href="#">{{ 'gameInfo'|trans }}</a>
        </li>
        <li class="profile-hor-nav-element">
            <a href="#">{{ 'accountInfo'|trans }}</a>
        </li>
    </ul>
</div>
<div class="profile-ver-nav">
    <ul class="nav nav-pills nav-stacked profile-menu-font">
        <li class="active profile-ver-nav-element">
            <a href="#">{{ 'matchHistory'|trans }}</a>
        </li>
        <li class="profile-ver-nav-element">
            <a href="#">{{ 'statistics'|trans }}</a>
        </li>
        <li class="profile-ver-nav-element">
            <a href="#">{{ 'charObj'|trans }}</a>
        </li>
    </ul>
</div>
{% endblock %}

en.xlf:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="1">
                <source>registrationMessage</source>
                <target>Enroll and fight for glory on the battlefields.</target>
            </trans-unit>
            <trans-unit id="2">
                <source>registrationSuccessMessage</source>
                <target>You will receive an email to finish your registration</target>
            </trans-unit>
            <trans-unit id="3">
                <source>gameInfo</source>
                <target>Game information</target>
            </trans-unit>
            <trans-unit id="4">
                <source>accountInfo</source>
                <target>Account information</target>
            </trans-unit>
            <trans-unit id="5">
                <source>matchHistory</source>
                <target>Match history</target>
            </trans-unit>
            <trans-unit id="6">
                <source>statistics</source>
                <target>Statistics</target>
            </trans-unit>
            <trans-unit id="7">
                <source>charObj</source>
                <target>Characters and Objects</target>
            </trans-unit>
        </body>
    </file>
</xliff>

fr.xlf:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file source-language="en" datatype="plaintext" original="file.ext">
        <body>
            <trans-unit id="1">
                <source>registrationMessage</source>
                <target>Inscrivez-vous et combattez pour la gloire sur les champs de bataille.</target>
            </trans-unit>
            <trans-unit id="2">
                <source>registrationSuccessMessage</source>
                <target>Vous allez recevoir un email pour completer votre inscription</target>
            </trans-unit>
            <trans-unit id="3">
                <source>gameInfo</source>
                <target>Informations en jeu</target>
            </trans-unit>
            <trans-unit id="4">
                <source>accountInfo</source>
                <target>Informations du compte</target>
            </trans-unit>
            <trans-unit id="5">
                <source>matchHistory</source>
                <target>Historique des parties</target>
            </trans-unit>
            <trans-unit id="6">
                <source>statistics</source>
                <target>Statistiques</target>
            </trans-unit>
            <trans-unit id="7">
                <source>charObj</source>
                <target>Personnages et Objets</target>
            </trans-unit>
        </body>
    </file>
</xliff>

编辑2:

因此,在检查之后,我实际上有了symfony的2.4.0版BETA1

我使用apache 2.4.4、php 5.4.16和mysql 5.6.12运行wampserver

希望你能帮我

事先谢谢你的帮助。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-01-14 19:22:43

我不知道为什么,但是在重新启动计算机(所以也是wampserver )之后,问题就消失了。如果你们知道为什么,我会很高兴听到的。

票数 7
EN

Stack Overflow用户

发布于 2014-06-19 13:53:17

我也犯过类似的错误,而且很简单。

您的问题可能在您的dependencyInjection包中使用的扩展中。在我的例子中,我用xmlFileLoader加载yml文件,如下所示:

代码语言:javascript
复制
<?php

namespace xxx\UserBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link   http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class xxxUserExtension extends Extension
{
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('user.yml');
        $loader->load('forms.yml');               
    }
}

我正在加载yml,所以我不得不使用YmlFileLoader而不是XmlFileLoader。

这里的附加信息:https://creativcoders.wordpress.com/2014/06/19/symfony2-symfonycomponentdependencyinjectionexceptioninvalidargumentexception-unable-to-parse-file/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21110262

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档