2010-11-09 66 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