gpt4 book ai didi

java - 无法找到 JAX-WS 架构 http ://jax-ws. dev.java.net/spring/servlet.xsd

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:57:47 25 4
gpt4 key购买 nike

我正在使用 Spring 框架实现 JAX-WS。

下面是我的Spring applicationContext.xml

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jax-ws.dev.java.net/spring/core
http://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet
http://jax-ws.dev.java.net/spring/servlet.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">

但是,Eclipse 正在提示:

Referenced file contains errors (http://jax-ws.dev.java.net/spring/servlet.xsd).

经过排查,我找到了网址: http://jax-ws.dev.java.net/spring/servlet.xsd不存在。相反,它似乎转移到: http://jax-ws.java.net/spring/servlet.xsd(您可以在浏览器中打开此链接)

因此,我更新了 XSD 架构 URL http://jax-ws.dev.java.net/spring/servlet.xsdhttp://jax-ws.java.net/spring/servlet.xsd

现在我的 applicationContext.xml 看起来像这样:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jax-ws.dev.java.net/spring/core
http://jax-ws.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet
http://jax-ws.java.net/spring/servlet.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">

实际上,通过此更改,Eclipse 错误消失了。问题是在 Tomcat 7 中启动 Web 服务后,我收到以下运行时错误:

org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 29; schema_reference.4: Failed to read schema document 'http://jax-ws.java.net/spring/servlet.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:433)

请指教。

非常感谢。问候,

最佳答案

您的问题是您将位置从 http://jax-ws.dev.java.net/spring/servlet.xsd 更改为至 http://jax-ws.java.net/spring/servlet.xsd .尽管后一个是正确的 url,但它与 jaxws-spring.jar META-INF/spring.schema 文件中定义的内容不匹配。该文件应具有以下内容

http\://jax-ws.dev.java.net/spring/core.xsd=spring-jax-ws-core.xsd
http\://jax-ws.dev.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd
http\://jax-ws.dev.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd

Spring 使用此映射在类路径中而不是在 Internet 中搜索模式。这些模式文件位于 jaxws-spring.jar 文件的根目录中。

请看Registering the handler and the schema

关于java - 无法找到 JAX-WS 架构 http ://jax-ws. dev.java.net/spring/servlet.xsd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14741729/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com