java – 由于servlet文件导致的xml错误无法找到元素的声明,Referenced文件包含错误
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java – 由于servlet文件导致的xml错误无法找到元素的声明,Referenced文件包含错误,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2217字,纯文字阅读大概需要4分钟。
内容图文
我不知道为什么会发生这些错误有人可以解释我如何解决它们 –
> cvc-elt.1:找不到元素’web_1:web-app’的声明.
>引用文件包含错误(jar:file:/ C:/ Program Files / eclipse / plugins / org.eclipse.jst.standard.schemas_1.2.0.v201101142102.jar!/dtdsAndSchemas/web-app_2_5.xsd).有关更多信息,请右键单击“问题视图”中的消息,然后选择“显示详细信息…”
这是我面临的两个错误,因为我错误地添加了一个servlet,我打算将一个普通的类文件添加到我的项目中.
然后这两个错误开始显示甚至我删除servlet文件.
这是我的xml代码(实际上它是基本代码) – 因为我还没有使用过单个servlet文件,我只使用了jsp文件.
仍然是xml文件 –
<?xml version="1.0" encoding="UTF-8"?>
<web_1:web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
xmlns:web_1="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID"
version="3.0">
<display-name>InitialD</display-name>
<web_1:welcome-file-list>
<web_1:welcome-file>index.html</web_1:welcome-file>
<web_1:welcome-file>index.htm</web_1:welcome-file>
<web_1:welcome-file>index.jsp</web_1:welcome-file>
<web_1:welcome-file>default.html</web_1:welcome-file>
<web_1:welcome-file>default.htm</web_1:welcome-file>
<web_1:welcome-file>default.jsp</web_1:welcome-file>
</web_1:welcome-file-list>
</web_1:web-app>
解决方法:
正如Mark和Saurabh所说,从web.xml文件中删除“web_1:”的每个实例都是可行的.同时,最好删除对模式“xmlns:web_1”的引用.一个基于Saurabh问题的可行片段如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID"
version="3.0">
<display-name>InitialD</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
内容总结
以上是互联网集市为您收集整理的java – 由于servlet文件导致的xml错误无法找到元素的声明,Referenced文件包含错误全部内容,希望文章能够帮你解决java – 由于servlet文件导致的xml错误无法找到元素的声明,Referenced文件包含错误所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。