java – 如何解决消息有效负载的类型为:BufferInputStream Mule中的异常

我已经转换为字节数组但我不断收到此错误
ERROR 2015-02-25 11:12:30,517 [[ESR].HTTP_Request_Listener.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Response code 400 mapped as failure. Message payload is of type: BufferInputStream
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Response code 400 mapped as failure. Message payload is of type: BufferInputStream (org.mule.module.http.internal.request.ResponseValidatorException)
  org.mule.module.http.internal.request.SuccessStatusCodeValidator:37 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/http/internal/request/ResponseValidatorException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 400 mapped as failure. Message payload is of type: BufferInputStream
    at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
    at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:202)
    at org.mule.module.http.internal.request.DefaultHttpRequester.process(DefaultHttpRequester.java:166)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

这是我的流程:

<sub-flow name="requestBeanCreate">
    <object-to-byte-array-transformer />
    <set-payload value="#[app.registry.messageBean.createServiceRequest(message.inboundProperties['http.uri.params']['name'],payload)]"/>
</sub-flow>

<flow name = "RequestsEntryFlow" >
    <http:listener allowedMethods="POST"  parseRequest="false"  config-ref="HTTP_Request_Listener" path="/{name}" doc:name="HTTP Entry Flow" />
    <flow-ref name="requestBeanCreate" />
    <choice doc:name="Choice">
        <when expression="#[app.registry.messageBean.isEMCrequired(payload)]">
            <jms:outbound-endpoint connector-ref="jms-connector" ref="EMCrequiredRequestsQueue" />
        </when>
        <otherwise>             
             <flow-ref name="req" />
        </otherwise>
    </choice>
</flow>

<http:request-config parseResponse="false" name="HTTP_Request_Configuration"   />

<sub-flow name = "req">    
    <set-variable variableName="id" value="#[payload]" doc:name="Variable" />
    <set-variable variableName="destination" value="#[app.registry.routerBean.getDestination(app.registry.messageBean.getReceiverID(payload))]"  doc:name="Variable" />
    <set-payload value="#[app.registry.messageBean.sendRequestToDestination(payload)]" />              
    <processor-chain>
    <http:request  parseResponse="false" config-ref="HTTP_Request_Configuration" host="#[flowVars.destination]" port="80" path="/" method="POST" />
        <object-to-byte-array-transformer />
        <expression-component>
            app.registry.messageBean.sendResponseToSender(flowVars.id);
            app.registry.messageBean.messageProcessedSuccessfully(flowVars.id);
        </expression-component>
    </processor-chain>
</sub-flow>

解决方法

您似乎从HTTP请求中获取了400状态代码,这会在到达变换器之前导致异常.尝试添加覆盖所有案例的成功状态代码验证器(您可以选择稍后考虑哪些案例):
<http:request parseResponse="false" config-ref="HTTP_Request_Configuration" host="#[flowVars.destination]" port="80" path="/" method="POST">
        <http:success-status-code-validator values="0..599"/>
    </http:request>

相关文章

ArrayList简介:ArrayList 的底层是数组队列,相当于动态数组。与 Java 中的数组相比,它的容量能动态增...
一、进程与线程 进程:是代码在数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位。 线程...
本文为博客园作者所写:&#160;一寸HUI,个人博客地址:https://www.cnblogs.com/zsql/ 简单的一个类...
#############java面向对象详解#############1、面向对象基本概念2、类与对象3、类和对象的定义格式4、...
一、什么是异常? 异常就是有异于常态,和正常情况不一样,有错误出错。在java中,阻止当前方法或作用域...
Collection接口 Collection接口 Collection接口 Collection是最基本的集合接口,一个Collection代表一组...