发现带有无效内容的AppEngine安全约束以元素url-pattern开头

时间:2013-03-19 06:10:39

标签: google-app-engine

我正在使用Eclipse和AppEngine SDK 1.7.5。

我尝试在我的Google App Engine项目中验证war文件夹。我的web.xml存在无效内容:

Invalid content was found starting with element 'url-pattern'. 
One of '{"http://java.sun.com/xml/ns/javaee":web-resource-name}' 
is expected.    web.xml /project/war/WEB-INF    line 121    XML Problem

这是错误引用的xml:

<security-constraint>
    <web-resource-collection>
        <url-pattern>/admin/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
</security-constraint>

如何解决错误?

1 个答案:

答案 0 :(得分:8)

它是一个副本,请参阅:Eclipse reporting problem in my web.xml, but it is processed fine

无论如何,请尝试添加web-resource-name元素,如下所示:

    <web-resource-collection>
        <web-resource-name>Admin Resources</web-resource-name>
        <url-pattern>/admin/*</url-pattern>
    </web-resource-collection>