首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >web-app_2_5.xsd在eclipse中验证web.xml时显示错误

web-app_2_5.xsd在eclipse中验证web.xml时显示错误
EN

Stack Overflow用户
提问于 2011-01-27 20:33:30
回答 3查看 28.2K关注 0票数 17

我不知道我能做什么,因为我花在编程上的时间太长了,我已经忘记了我可能做了什么。但是现在,当我加载Eclipse时,它会说:

The errors below were detected when validating the file "web-app_2_5.xsd" via the file "web.xml".  In most cases these errors can be detected by validating "web-app_2_5.xsd" directly.  However it is possible that errors will only occur when web-app_2_5.xsd is validated in the context of web.xml. 
s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw 'JDK 6 XML-related APIs'.
The entity name must immediately follow the '&' in the entity reference.

我的前几行web.xml代码看起来是这样的。

<?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_5.xsd"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 id="WebApp_ID" version="2.5">

我读到这可能是一个服务器的错误,从哪里检索文件,或与缓存。我已经禁用并清除了缓存,据我所知,服务器和其他人使用的是一样的,除非他们切换到oracle.com url,而我还没有找到它。

任何想法都将不胜感激。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-01-27 22:02:19

参见http://www.reddit.com/r/programming/comments/f9sxu。问题还是在甲骨文身上。我无法在连接到互联网的SGES 2.1.1上进行部署。当我关闭它时,部署很慢,但很成功。验证器似乎尝试刷新缓存的模式并从schemaLocation URL下载它们。

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
GET /xml/ns/javaee/web-app_2_5.xsd ... 
HTTP/1.1 301 Moved Permanently to Location: 
  http://download.oracle.com/javase/6/docs/technotes/guides/xml/index.html

但是没有这样的模式!

我会尝试找到一些好的解决方案,但最好的办法可能是在甲骨文里打人……

编辑:这是固定的时间(2010年1月27日,20:00CET),Oracle返回模式-您可以用wget检查它。浏览器被重定向到文档。不错:-)

票数 3
EN

Stack Overflow用户

发布于 2011-02-02 17:53:46

安德鲁,恐怕你的名字空间不正确。我认为2.5版本应该使用javaee名称空间(JDK,Java1.5和1.6),而不是j2ee (J2SDK,Java1.4)。

所以替换掉

http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd

使用

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
票数 23
EN

Stack Overflow用户

发布于 2011-01-27 23:11:01

或者编写自己的实体解析器,它将在本地查找这些实体

例如,在hibernate中,以适当的方式指出模式位置就足够了:hibernate的DTDEntityResolver摘录

private static final String USER_NAMESPACE = "classpath://";
 ...
public InputSource resolveEntity(String publicId, String systemId) {
 ...
else if ( systemId.startsWith( USER_NAMESPACE ) ) {
...

对于eclipse,您可以在: Preferences-->XML-->XML Catalog中指向本地xsd。

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

https://stackoverflow.com/questions/4816330

复制
相关文章

相似问题

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