【问题标题】:Start the application with jaxws:client even whenthe web service is unavailable使用 jaxws:client 启动应用程序,即使 Web 服务不可用
【发布时间】:2017-10-23 04:59:53
【问题描述】:

我有一个带有 JAX-WS 客户端的应用程序。

<jaxws:client name="http://XXXXXX"
              wsdlLocation="YYYYY.wsdl"
              createdFromAPI="true">
    <jaxws:properties>
        <entry key="ws-security.sts.client" value-ref="ZZZZZZZ" />
    </jaxws:properties>
</jaxws:client>

在webservice宕机期间启动应用时,spring上下文失败,应用根本不启动。

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [XXXX]: Constructor threw exception; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'https://YYYYY.wsdl'.: java.net.UnknownHostException: YYYYY
Caused by: java.net.UnknownHostException: YYYYY

如何配置应用程序以使其启动并且 spring 配置不会失败。
我了解只要网络服务关闭,网络服务客户端就无法工作。
一旦网络服务可用,我需要应用程序启动并使用它。

【问题讨论】:

    标签: java spring cxf jax-ws


    【解决方案1】:

    您可以将 WSDL 文件放入您的类路径并在 wsdlLocation 中找到它。

    点赞wsdlLocation="yyyyy.wsdl"

    或者您可以以编程方式处理它。详情here

    【讨论】:

    • "把 WSDL 文件放到你的类路径中" -> 这就是我试过的。但这无济于事,因为 WSDL 的导入本身具有 schemaLocations 可能不可用。
    猜你喜欢
    • 1970-01-01
    • 2011-01-26
    • 1970-01-01
    • 2011-02-19
    • 2018-02-09
    • 1970-01-01
    • 1970-01-01
    • 2014-11-12
    • 1970-01-01
    相关资源
    最近更新 更多