在 jboss 上部署应用程序期间无法解析 WSDL - 可能是 Woodstox [英] Failed to parse WSDL during deploying app on jboss - maybe Woodstox

查看:35
本文介绍了在 jboss 上部署应用程序期间无法解析 WSDL - 可能是 Woodstox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 jboss 上部署应用程序时遇到问题.我发现一些信息表明更改 woodstox 版本可能会有所帮助,但这不是...日志:

I've a problem during deploying application on jboss. I found some information that changing version of woodstox might help, but it wasn't... Log:

16:58:09,079 INFO  [stdout] (MSC service thread 1-2) [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] Failed to parse WSDL
16:58:09,080 INFO  [stdout] (MSC service thread 1-2) javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.RuntimeException: Cannot create a secure XMLInputFactory
16:58:09,080 INFO  [stdout] (MSC service thread 1-2)    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:257)

16:58:09,104 INFO  [stdout] (MSC service thread 1-2) Caused by: java.lang.RuntimeException: Cannot create a secure XMLInputFactory
16:58:09,104 INFO  [stdout] (MSC service thread 1-2)    at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:312)

16:58:09,514 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) Context initialization failed: org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[cxf://bean:adapter.NotificationService?dataFormat=PAYLOAD]. Reason: org.apache.cxf.service.factory.ServiceConstructionException: No valid WSDL classpath:/interface/adapter/notification-service/v10/NotificationService.wsdl nor service class is specified.
        at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:409) [camel-core-2.12.3.jar:2.12.3]
        at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123) [camel-core-2.12.3.jar:2.12.3]

我完全不知道我还能检查什么...我的环境:

I've absolutely no idea what else can i check... My environment:

  • svn 1.7.9 (r1462340) Apache Maven 3.1.1
  • (0728685237757ffbf44136acec0402957f723d9a;2013-09-17 Maven 主页:
  • Java 版本:1.7.0_45,供应商:Oracle Corporation 操作系统名称:linux",
  • 版本:3.11.0-12-generic",arch:amd64",系列:unix"javac
  • 1.7.0_45 java 版本1.7.0_45"Java(TM) SE 运行时环境(构建 1.7.0_45-b18)
  • jboss 中的 Woodstox:4.1.1(我将其更改为 4.2.1 和 4.2.0)

我的 wsdl 定义:

My wsdl definition:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="NotificationService"
    targetNamespace="http://service/NotificationService/v10"
    xmlns:tns="http://service/NotificationService/v10"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

    <wsdl:types>
        <xs:schema
            targetNamespace="http://service/NotificationService/v10">
            <xs:include schemaLocation="NotificationService.xsd" />
        </xs:schema>
    </wsdl:types>

    <!-- notifyPaymentStatus message-->

    <wsdl:message name="notifyPaymentStatusParameters">
        <wsdl:part name="notifyPaymentStatusPart" element="tns:notifyPaymentStatusRQ">
        </wsdl:part>
    </wsdl:message>
    <wsdl:message name="notifyPaymentStatusResult">
        <wsdl:part name="notifyPaymentStatusPart" element="tns:notifyPaymentStatusRS">
        </wsdl:part>
    </wsdl:message>


    <!-- notifyError message-->

    <wsdl:message name="notifyErrorParameters">
        <wsdl:part name="notifyErrorPart" element="tns:notifyErrorRQ">
        </wsdl:part>
    </wsdl:message>
    <wsdl:message name="notifyErrorResult">
        <wsdl:part name="notifyErrorPart" element="tns:notifyErrorRS">
        </wsdl:part>
    </wsdl:message>


    <wsdl:portType name="NotificationService">
        <wsdl:operation name="notifyPaymentStatus">
            <wsdl:input name="notifyPaymentStatusParameters" message="tns:notifyPaymentStatusParameters" />
            <wsdl:output name="notifyPaymentStatusResult" message="tns:notifyPaymentStatusResult" />
        </wsdl:operation>
        <wsdl:operation name="notifyError">
            <wsdl:input name="notifyErrorParameters" message="tns:notifyErrorParameters" />
            <wsdl:output name="notifyErrorResult" message="tns:notifyErrorResult" />
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="NotificationServiceBinding" type="tns:NotificationService">
        <soap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="notifyPaymentStatus">
            <soap:operation soapAction="" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="notifyError">
            <soap:operation soapAction="" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="NotificationService">
        <wsdl:port name="NotificationServicePort" binding="tns:NotificationServiceBinding">
            <soap:address location="http://www.example.org/" />
        </wsdl:port>
    </wsdl:service>


</wsdl:definitions>

和端点:

<cxf:cxfEndpoint id="adapter.NotificationService"
    endpointName="s:NotificationServicePort" serviceName="s:NotificationService"
    wsdlURL="classpath:/interface/adapter/notification-service/v10/NotificationService.wsdl"
    xmlns:s="http://service/NotificationService/v10">
    <cxf:properties>
        <entry key="schema-validation-enabled"
            value="true" />
    </cxf:properties>
    <cxf:inInterceptors>
        <ref bean="logInInterceptor" />
    </cxf:inInterceptors>
    <cxf:inFaultInterceptors>
        <ref bean="logInInterceptor" />
    </cxf:inFaultInterceptors>
    <cxf:outInterceptors>
        <ref bean="logOutInterceptor" />
    </cxf:outInterceptors>
    <cxf:outFaultInterceptors>
        <ref bean="logOutInterceptor" />
    </cxf:outFaultInterceptors>
</cxf:cxfEndpoint>

我在调试时发现了一些属性,它被称为:org.apache.cxf.stax.allowInsecureParser.如何将其设置为true?在这些情况下,我可能不会在解析 wsdl 时遇到任何问题.

When i was debugging i found some property, which is called: org.apache.cxf.stax.allowInsecureParser. How can I set it on true? In these case probably I won't have any problems with parsing wsdl.

推荐答案

这个解决方法对我来说很好:

this one workaround works fine for me:

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject">
        <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
            <property name="targetClass" value="java.lang.System" />
            <property name="targetMethod" value="getProperties" />
        </bean>
    </property>
    <property name="targetMethod" value="putAll" />
    <property name="arguments">
        <util:properties>
            <prop key="org.apache.cxf.stax.allowInsecureParser">true</prop>
        </util:properties>
    </property>
</bean>

来自:CXF 2.7.x Woodstox 通过 Maven 兼容

我发现在我的依赖项中我有正确的 lib: 4-2-0,但我不知道为什么 jboss 使用来自某个地方的另一个 lib...在我看来更好的解决方案是将 jboss 设置为不覆盖库.在另一种情况下,我仍然收到这样的警告:

I found that in my dependencies I've correct lib: 4-2-0, but I don't know why jboss is using another lib from somewhere... In my opinion better sollution would be to set on jboss to not overwrite libraries. In another case I'm still getting warning like this:

2014-06-27 12:59:58,932 WARN  (MSC service thread 1-16) [org.apache.cxf.staxutils.StaxUtils] Could not create a secure Stax XMLInputFactory.  Found class com.ctc.wstx.stax.WstxInputFactory.  Suggest Woodstox 4.2.0 or newer. 

这篇关于在 jboss 上部署应用程序期间无法解析 WSDL - 可能是 Woodstox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆