使用spring-ws客户端的骆驼路线偶尔会破坏jaxb

时间:2016-03-01 13:06:32

标签: java spring jaxb apache-camel

我的骆驼路线偶尔会失败:

Caused by: org.springframework.ws.client.WebServiceTransformerException: Transformation error: Can't transform a Source of type javax.xml.transform.stax.StAXSource; nested exception is javax.xml.transform.TransformerException: Can't transform a Source of type javax.xml.transform.stax.StAXSource
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:610) ~[spring-ws-core-2.1.4.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:539) ~[spring-ws-core-2.1.4.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:494) ~[spring-ws-core-2.1.4.RELEASE.jar:na]
at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceive(WebServiceTemplate.java:481) ~[spring-ws-core-2.1.4.RELEASE.jar:na]
at org.apache.camel.component.spring.ws.SpringWebserviceProducer.process(SpringWebserviceProducer.java:87) ~[camel-spring-ws-2.13.0.jar:2.13.0]

路由更长,但这是jaxb编组的核心代码段:

from("direct:ins").routeId("ARCHIVING_CHAT") .setHeader("chat", body()) .to("bean:convertChatToRequest?method=createSaveObjectRequest") .marshal(jaxb) .to("log:eAarkivA2A_REQUEST?level=INFO") .beanRef("archivingSlip") .to("bean:checkResponse")

来自camel-config.xml:

<bean id="baseCamelMarshallerWSTemplate" class="org.springframework.ws.client.core.WebServiceTemplate" scope="prototype">
        <constructor-arg ref="messageFactory" />
        <property name="checkConnectionForError" value="true"/>
        <!--<property name="transformerFactory" value="com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"/>-->
        <property name="transformerFactoryClass" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
        <property name="marshaller" ref="marshaller" />
        <property name="unmarshaller" ref="marshaller" />
    </bean>

大部分时间这都很完美。只是偶尔在重启camel-service后失败。当它破坏通过路线的所有交通时。对于计划重新启动服务器的生产,此随机性无效。

我看过这个但没有帮助:Camel route using spring-ws client occasionally throws javax.xml.transform.stax.StAXSource exception

我应该寻找哪些想法以确保永远不会发生这种情况? THX。

0 个答案:

没有答案