分散收集路由错误。消息有效内容的类型为:String

时间:2014-12-20 08:39:32

标签: mule mule-studio

我是Mule的新手,在Anypoint Studio上处理一个相当简单的Hello World示例来测试Scatter / Gather流量控制元素时,我得到了以下错误,而没有其他错误信息方式:

ERROR 2014-12-19 22:00:30,172 [[unifinesb].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message : Exception was found for route(s): 0. Message payload is of type: String
Type : org.mule.routing.CompositeRoutingException
Code : MULE_ERROR--2
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html
Payload : /Waldo
********************************************************************************
Exception stack is:
1. Exception was found for route(s): 0. Message payload is of type: String (org.mule.routing.CompositeRoutingException)
org.mule.routing.CollectAllAggregationStrategy:51 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/routing/CompositeRoutingException.html)
********************************************************************************
Root Exception stack trace:
org.mule.routing.CompositeRoutingException: Exception was found for route(s): 0. Message payload is of type: String
at org.mule.routing.CollectAllAggregationStrategy.aggregateWithFailedRoutes(CollectAllAggregationStrategy.java:51)
at org.mule.routing.CollectAllAggregationStrategy.aggregate(CollectAllAggregationStrategy.java:38)
at org.mule.routing.ScatterGatherRouter.processResponses(ScatterGatherRouter.java:207)
at org.mule.routing.ScatterGatherRouter.process(ScatterGatherRouter.java:135)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44)
at ...

从错误的最高描述来判断,我理解Scatter聚集不接收String有效负载的问题,即使组件的当前文档没有提到任何类型。它是否正确?

我正在运行的流程相当简单,从入站http接收String并尝试将其路由到将使用String打印内容(返回text / plain)和DB到的REST服务将String存储在表中。相关代码如下:

<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" doc:name="HTTP"/>
<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Filter browser icon padding"/>
<logger message="current payload is #[payload]" level="INFO" doc:name="Startup log - to stdout"/>
<scatter-gather doc:name="Scatter-Gather">
<processor-chain>
<logger message="#['Rest branch msg input :' + payload]" level="DEBUG" doc:name="File Logger"/>
<http:outbound-endpoint exchange-pattern="request-response" method="POST" address="http://localhost:8080/application/rest/mensaje?givenName=#[payload]" doc:name="REST Service"/>
<logger message="#['Rest msg output :' + payload]" level="DEBUG" doc:name="File Logger"/>
</processor-chain>
<processor-chain>
<logger message="#['Database msg input :' + payload]" level="DEBUG" doc:name="File Logger"/>
<db:insert config-ref="MySQL_VestaLocal" doc:name="Application Postgress">
<db:parameterized-query><![CDATA[insert into http_user_info (first_name) values ('#[payload]');]]></db:parameterized-query>
</db:insert>
<logger message="#['Database msg output :' + payload]" level="DEBUG" doc:name="File Logger"/>
</processor-chain>
</scatter-gather>
<set-payload value="#['REST DB Success!']" doc:name="Set Payload"/>

通过网络搜索我发现这个旧的Mule JIRA问题有一个类似于我所获得的例外,但尝试建议的解决方案(解决方法?)对我没有做任何事情:{{3 }}

1 个答案:

答案 0 :(得分:5)

你的路线0发生了错误。

您将根据文档获得复合路由异常:

  

CompositeRoutingException是3.5.0 Runtime的新增功能。它延伸   Mule MessagingException用于聚合来自不同的异常   在单个消息路由器的上下文中的路由。例外情况是   通过顺序ID与每条路线相关联。

     

此异常公开了两种允许您获取ID的方法   失败的路由和每条路由返回的异常。

     

getExceptions方法返回一个映射,其中键是一个整数   标识失败路由的索引,值为   例外本身。 getExceptionForRouteIndex(int)方法返回   请求的路由ID除外。

由于你没有execption策略,toString是对该异常的调用,只打印路由失败(与有效负载为String的事实无关)

请使用以下的排除策略来确切地找出错误:

<catch-exception-strategy doc:name="Catch Exception Strategy">
    <logger level="ERROR" message="#[exception.exceptions]"/>
</catch-exception-strategy>