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

前端之家收集整理的这篇文章主要介绍了java – 如何解决消息有效负载的类型为:BufferInputStream Mule中的异常前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经转换为字节数组但我不断收到此错误
  1. ERROR 2015-02-25 11:12:30,517 [[ESR].HTTP_Request_Listener.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:
  2. ********************************************************************************
  3. Message : Response code 400 mapped as failure. Message payload is of type: BufferInputStream
  4. Code : MULE_ERROR--2
  5. --------------------------------------------------------------------------------
  6. Exception stack is:
  7. 1. Response code 400 mapped as failure. Message payload is of type: BufferInputStream (org.mule.module.http.internal.request.ResponseValidatorException)
  8. org.mule.module.http.internal.request.SuccessStatusCodeValidator:37 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/http/internal/request/ResponseValidatorException.html)
  9. --------------------------------------------------------------------------------
  10. Root Exception stack trace:
  11. org.mule.module.http.internal.request.ResponseValidatorException: Response code 400 mapped as failure. Message payload is of type: BufferInputStream
  12. at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
  13. at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:202)
  14. at org.mule.module.http.internal.request.DefaultHttpRequester.process(DefaultHttpRequester.java:166)
  15. + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
  16. ********************************************************************************

这是我的流程:

  1. <sub-flow name="requestBeanCreate">
  2. <object-to-byte-array-transformer />
  3. <set-payload value="#[app.registry.messageBean.createServiceRequest(message.inboundProperties['http.uri.params']['name'],payload)]"/>
  4. </sub-flow>
  5.  
  6. <flow name = "RequestsEntryFlow" >
  7. <http:listener allowedMethods="POST" parseRequest="false" config-ref="HTTP_Request_Listener" path="/{name}" doc:name="HTTP Entry Flow" />
  8. <flow-ref name="requestBeanCreate" />
  9. <choice doc:name="Choice">
  10. <when expression="#[app.registry.messageBean.isEMCrequired(payload)]">
  11. <jms:outbound-endpoint connector-ref="jms-connector" ref="EMCrequiredRequestsQueue" />
  12. </when>
  13. <otherwise>
  14. <flow-ref name="req" />
  15. </otherwise>
  16. </choice>
  17. </flow>
  18.  
  19. <http:request-config parseResponse="false" name="HTTP_Request_Configuration" />
  20.  
  21. <sub-flow name = "req">
  22. <set-variable variableName="id" value="#[payload]" doc:name="Variable" />
  23. <set-variable variableName="destination" value="#[app.registry.routerBean.getDestination(app.registry.messageBean.getReceiverID(payload))]" doc:name="Variable" />
  24. <set-payload value="#[app.registry.messageBean.sendRequestToDestination(payload)]" />
  25. <processor-chain>
  26. <http:request parseResponse="false" config-ref="HTTP_Request_Configuration" host="#[flowVars.destination]" port="80" path="/" method="POST" />
  27. <object-to-byte-array-transformer />
  28. <expression-component>
  29. app.registry.messageBean.sendResponseToSender(flowVars.id);
  30. app.registry.messageBean.messageProcessedSuccessfully(flowVars.id);
  31. </expression-component>
  32. </processor-chain>
  33. </sub-flow>

解决方法

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

猜你在找的Java相关文章