当我部署到jboss时,Camel验证无效,与mvn jetty:run
完美配合。请参阅以下错误:
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: Source parameter of type 'org.apache.camel.StringSource' is not compatible with result parameter of type 'javax.xml.transform.stream.StreamResult'.
at org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
at org.apache.camel.processor.validation.ValidatingProcessor.doProcess(ValidatingProcessor.java:152)
at org.apache.camel.processor.validation.ValidatingProcessor.process(ValidatingProcessor.java:87)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
at org.apache.camel.processor.validation.ValidatingProcessor.process(ValidatingProcessor.java:82)
at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)
at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
....
下面的Camel Route配置:
<camel:route id="process-xml-file" startupOrder="200">
<from uri="direct:process-xml-file"/>
<log message="processing file ${file:name}"/>
<choice>
<when>
<xpath>/invoices/@region='regionA'</xpath>
<split streaming="true" parallelProcessing="true">
<tokenize token="invoice" inheritNamespaceTagName="dataexport" xml="true"/>
<doTry>
<to uri="validator:xml/invoice.xsd"/>
<to uri="processInv"/>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
<exception>java.sql.SQLException</exception>
<setBody>
<simple>${exception.message}\n${body}</simple>
</setBody>
<to uri="direct:error-notification"/>
</doCatch>
</doTry>
</split>
</when>
<otherwise>
<log message="ignoring file ${file:name}, not 'invoice'"/>
</otherwise>
</choice>
</camel:route>
答案 0 :(得分:0)
我刚检查了代码 org.apache.xerces.jaxp.validation.StreamValidatorHelper并发现我们可以通过在调用validate方法时不设置结果类型来解决此问题。 所以我在驼峰填充JIRA来跟踪此问题,您可以通过移植补丁或使用包含补丁的最新快照来解决此问题