【发布时间】:2018-09-28 05:25:05
【问题描述】:
我是 ServiceMix 的新手,正在尝试在 ServiceMix 中进行异常处理。
当我尝试打印异常时,它还包含请求的正文。有什么方法可以只从异常中提取错误?
<from uri="activemq:topic://topic1"/>
<!-- Schema validationm for the request received from Biblio -->
<doTry>
<to uri="validator:http://localhost/employee.xsd"/>
<doCatch>
<exception>java.lang.Exception</exception>
<log message="${exception.message}"/>
</doCatch>
</doTry>
以下是记录的异常:
org.apache.xerces.jaxp.validation.SimpleXMLSchema@a0059b5
errors: [
org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: 'asd' is not a valid value for 'integer'., Line : -1, Column : -1
org.xml.sax.SAXParseException: cvc-type.3.1.3: The value 'asd' of element 'empnumber' is not valid., Line : -1, Column : -1
]. Exchange[ID-GBSMIXDEV01-uk-oup-com-46713-1511957485149-83-2][Message: <empRecord>
<employee>
<empnumber>asd</empnumber>
<surname>PM</surname>
<firstname>Abhinay</firstname>
</employee>
</empRecord>]
我得到了正确的异常,但我不希望异常中的以下部分。
有什么方法可以从异常消息中删除这些?
Exchange[ID-GBSMIXDEV01-uk-oup-com-46713-1511957485149-83-2][Message: <empRecord>
<employee>
<empnumber>asd</empnumber>
<surname>PM</surname>
<firstname>Abhinay</firstname>
</employee>
</empRecord>]
【问题讨论】:
标签: exception-handling apache-camel blueprint-osgi apache-servicemix