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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14741729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 17:13:25  来源:igfitidea点击:

JAX-WS Schema http://jax-ws.dev.java.net/spring/servlet.xsd not able to be found

javaweb-servicesspringjax-ws

提问by Zhan

I am implementing JAX-WS with Spring framework.

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

The following is my Spring applicationContext.xml

以下是我的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
    ">

However, Eclipse is complaining:

但是,Eclipse 抱怨:

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

引用的文件包含错误 ( http://jax-ws.dev.java.net/spring/servlet.xsd)。

After investigation, I find the URL: http://jax-ws.dev.java.net/spring/servlet.xsdDoes not exist. Instead, it seems be move to: http://jax-ws.java.net/spring/servlet.xsd(You can open this link in the brower)

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

Therefore, I updated XSD schema URL from http://jax-ws.dev.java.net/spring/servlet.xsdto http://jax-ws.java.net/spring/servlet.xsd

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

Now my applicationContext.xml looks like this:

现在我的 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
    ">

Actually with this change the Eclipse error goes away. The problem is after launching the web service in Tomcat 7, I get the following runtime error instead:

实际上,通过此更改,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)

org.xml.sax.SAXParseException; 行号:20;列数:29;schema_reference.4: 无法读取架构文档“ http://jax-ws.java.net/spring/servlet.xsd”,因为 1) 找不到文档;2) 无法读取文件;3) 文档的根元素不是 。在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) 在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99)在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:433)

Please advise.

请指教。

Thank you very much. Regards,

非常感谢你。问候,

回答by Lan

Your problem is that you change the location from http://jax-ws.dev.java.net/spring/servlet.xsdto http://jax-ws.java.net/spring/servlet.xsd. Even though the latter one is the right url, it does not match what is defined in your jaxws-spring.jar META-INF/spring.schema file. That file should have the following content

您的问题是您将位置从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 uses this mapping to search the schema in the classpath rather than to internet. Those schema files are located at the root of the jaxws-spring.jar file.

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

Please take a look Registering the handler and the schema

请查看注册处理程序和架构

回答by colo

are you using spring in your project?, I had the same problem, but when I included spring-jaxws in my maven dependencies the problem solved, in fact, yo can see in that jar that the META-INF/spring.schemas file is redefining the XSDs locations

你在你的项目中使用 spring 吗?,我遇到了同样的问题,但是当我在我的 Maven 依赖项中包含 spring-jaxws 时,问题解决了,事实上,你可以在那个 jar 中看到 META-INF/spring.schemas 文件是重新定义 XSD 位置

回答by Mac S

Resources have moved, final config should be:

资源已移动,最终配置应为:

xsi:schemaLocation="http://www.springframework.org/schema/beans        
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-3.2.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/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"
        default-lazy-init="true">

回答by manocha_ak

Probably not a case with yours. But in such a scenario, do clean and make a fresh build. Reason being the older spring jar and xsd from there would be taken if the two jars exits. Hope that helps for other guys .... generically this exception will be thrown for many reasons.

可能不是你的情况。但在这种情况下,请清理并重新构建。原因是如果两个 jar 退出,则将从那里获取较旧的 spring jar 和 xsd。希望对其他人有所帮助......通常会出于多种原因抛出此异常。