2010-11-09 64 views
0

在Spring文件applicationConfig.xml中,JAX-WS集成需要一些特定的模式。 我最近成功地使用这些声明:Spring和Jax-WS:哪里有xsd模式?

    [我必须删除所有网址(因为这是我的第一个问题)

    该文件以那些声明开头:
    <beans xmlns="http www.springframework.org/schema/beans" xmlns:xsi="http www.w3.org/2001/XMLSchema-instance" xmlns:aop="http www.springframework.org/schema/aop" xmlns:tx="http www.springframework.org/schema/tx" xmlns:context="http www.springframework.org/schema/context" 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.xsd http www.springframework.org/schema/aop http www.springframework.org/schema/aop/spring-aop.xsd http www.springframework.org/schema/tx http www.springframework.org/schema/tx/spring-tx.xsd http www.springframework.org/schema/context http www.springframework.org/schema/context/spring-context.xsd http jax-ws.dev.java.net/spring/core https jax-ws.dev.java.net/spring/core.xsd http jax-ws.dev.java.net/spring/servlet https jax-ws.dev.java.net/spring/servlet.xsd">
    (...)
    <ws:service id="myService" bean="#myWS" />
    <wss:binding url="/services/myws" service="#myService" />

    现在,迁移时对网站jax-ws.dev.java.net。这些文件都没有找到,我已经在使用Tomcat和Eclipse下的一些错误:

    org.xml.sax.SAXParseException:schema_reference.4:无法读取模式文档“https://jax-ws.dev。 java.net/spring/core.xsd',因为1)找不到文档; 2)文件无法阅读; 3)文档的根元素不是。

    有没有解决方案或什么来防止这个错误?

    谢谢

    +0

    嘿,我面临同样的问题。你有没有得到任何解决方案? – 2013-02-06 10:18:54

    回答

    1

    我想你正在使用maven建设吗?尝试,如果你不使用Maven添加依赖性pom.xml中

    <dependency> 
         <groupId>javax.xml.ws</groupId> 
         <artifactId>jaxws-api</artifactId> 
         <version>2.1-1</version> 
    </dependency> 
    

    ,确保你有你的类路径JAX-WS库。 http://java.net/projects/jax-ws

    +0

    这不是一个编译问题......我把所有的库放在我的类路径中。在Tomcat下部署应用程序时发生错误。我认为,春天读取applicationContext.xml并尝试读取所有XSD架构。 – 2010-11-09 17:27:17

    +0

    将它编译并添加到类路径中是两件不同的事情。那说了什么在这种情况下帮助我增加了对' org.jvnet.jax-ws-commons.spring',' jaxws-spring' – Hille 2015-08-03 15:46:05

    4

    Finaly我从JAXWS - 弹簧 - 1.8.jar(lib中JAXWS使用Spring工作)提取XSD。 我把这些XSD放在WEB-INF目录下,就在applicationContext.xml附近。 我修改方案的声明,在这个文件中有:

    http://jax-ws.dev.java.net/spring/core classpath:spring-jax-ws-core.xsd 
        http://jax-ws.dev.java.net/spring/servlet classpath:spring-jax-ws-servlet.xsd 
    

    我在这里看到了解决方案: Spring schemaLocation fails when there is no internet connection

    1

    你并不需要从JAXWS弹簧罐子提取XSD。 你只需要确保您使用的URL对应于在罐中的META-INF/spring.schemas文件

    它们的定义如下:

    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 
    

    认为你只需要更换https与http。 E.G:

    <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> 
    

    有关spring.schemas更多信息,请参阅here