Mule - 出站端点中的异常消息有效内容的类型为:byte []

时间:2014-12-31 07:24:46

标签: java https mule esb

嗨,你在骡子的Https出站端点,但总是得到一个异常,说消息有效负载的类型为byte []

INFO 2014-12-31 12:55:02,699 [[collectFlow] .connector.VM.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager:Starting:' connector.VM.mule .default.dispatcher.12905544&#39 ;.对象是:VMMessageDispatcher INFO 2014-12-31 12:55:02,699 [[collectFlow] .ScatterGatherWorkManager.01] org.mule.lifecycle.AbstractLifecycleManager:开始:' IPS-HTTPS-TwoWaySSL-Connector.dispatcher.14325410'。对象是:HttpsClientMessageDispatcher ERROR 2014-12-31 12:55:04,961 [[collectFlow] .collectFlow.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:


消息:找到路由的异常:0。消息有效负载的类型为:byte []

代码:MULE_ERROR - 2

异常堆栈是: 1.找到路由的异常:0。消息有效负载的类型为:byte [](org.mule.routing.CompositeRoutingException)   org.mule.routing.CollectAllAggregationStrategy:51(http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html



<scatter-gather doc:name="Scatter-Gather">
            <processor-chain>
                <logger message="Just before calling https" level="INFO" doc:name="Logger"/>
                <set-property propertyName="Content-Type" value="text/xml" doc:name="Property"/>
                <https:outbound-endpoint exchange-pattern="request-response" host:"localhost" port:"8080" path="test" method="POST" connector-ref="IPS-HTTPS-TwoWaySSL-Connector" tracking:enable-default-events="true"  doc:name="HTTPS" encoding="UTF-8" mimeType="text/xml" contentType="text/xml"/>
            </processor-chain>
			<vm:outbound-endpoint exchange-pattern="one-way"
				 doc:name="Logger In Queue" path="FlowIn"/>
		</scatter-gather>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

问题在于聚合策略。由于您没有定义任何自定义策略,因此Mule使用默认策略(默认聚合器 CollectAllAggregationStrategy 不处理 byte [] 有效负载)

如果您不需要分散消息中的任何信息,只需实施虚拟聚合器策略来创建mule事件:

流速:

<scatter-gather doc:name="Scatter-Gather">
            <custom-aggregation-strategy class="org.myproject.DummyAggregationStrategy" /> 
            <processor-chain>
                <logger message="Just before calling https" level="INFO" doc:name="Logger"/>
                <set-property propertyName="Content-Type" value="text/xml" doc:name="Property"/>
                <https:outbound-endpoint exchange-pattern="request-response" host:"localhost" port:"8080" path="test" method="POST" connector-ref="IPS-HTTPS-TwoWaySSL-Connector" tracking:enable-default-events="true"  doc:name="HTTPS" encoding="UTF-8" mimeType="text/xml" contentType="text/xml"/>
            </processor-chain>
            <vm:outbound-endpoint exchange-pattern="one-way"
                 doc:name="Logger In Queue" path="FlowIn"/>
        </scatter-gather>

策略类:

public class DummyAggregationStrategy implements AggregationStrategy {

    @Override
    public MuleEvent aggregate(AggregationContext context) throws MuleException {
        if(context.collectEventsWithoutExceptions().isEmpty())
            return new DefaultMuleMessage();
        else
            return DefaultMuleEvent.copy(context.collectEventsWithoutExceptions().get(0));
    }
}

查看分散聚集documentation以获取更多信息。