2014-12-20 37 views
0

我是新來的騾子,雖然上Anypoint Studio的一個相當簡單的Hello World例子努力考出分散/集中流動控制元件,我發現了以下錯誤,沒有別的不多在信息的方式:分散收集路由錯誤。消息負載的類型爲:字符串

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 ... 

從錯誤的頂部描述來看,我理解的問題是分散收集不接受字符串的有效載荷,即使該組件的當前文檔中提到這樣的事。它是否正確?

我正在運行的流程非常簡單,從入站http接收String並嘗試將其路由到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"/> 

通過網絡蒐羅我發現這個老騾子JIRA問題與類似什麼我得到的,但嘗試了建議的解決方案(解決方法嗎?)我沒有做什麼異常:https://www.mulesoft.org/jira/browse/MULE-7594

回答

5

一些錯誤路線0

你得到的複合路由異常,因爲每個文檔正在發生的事情:

的CompositeRoutin gException對於3.5.0運行時是新的。它延伸 騾MessagingException聚集來自不同 路由例外在單個消息路由器的上下文。例外情況是 與通過順序ID的每條路線相關。

此異常暴露了兩個方法,讓你獲得的ID失敗路線 和每條路線返回的例外。

getExceptions方法返回一個映射,其中鍵是一個整數 ,標識失敗路由的索引,該值本身是 異常。 getExceptionForRouteIndex(int)方法返回 請求的路由標識的異常。

當你沒有一個execption戰略,是的toString調用該異常,並且只打印失敗(即沒有任何關係的事實,有效載荷爲String)

請路線使用以下免除策略找出究竟是什麼錯誤:

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

非常感謝與異常日誌記錄的小細節。放置了你建議的catch後,其他信息顯示我調用的REST服務沒有實現POST方法 - 我沒有注意到POST是Mule http連接器的默認值。 –

相關問題