【问题标题】:Mule - failed to route via HTTP outbound endpointMule - 无法通过 HTTP 出站端点路由
【发布时间】:2014-05-08 21:58:51
【问题描述】:

我有一个 Mule 流,它将一个入站文件转换为一些 XML,我希望将它发布到一个 HTTP 出站端点,但是当我尝试这样做时我的流失败了。我的流程如下所示:

<flow name="mainFlow" processingStrategy="synchronous">
   <file:inbound-endpoint name="fileIn" path="path/to/file"/>

   <file:file-to-string-transformer />

   <component class="CUSTOM JAVA CLASS TO CONVERT CSV INPUT TO BASIC XML"/>

   <mulexml:xml-to-dom-transformer returnClass="org.w3c.dom.Document"/>

   <!-- XSLT converts my Java-produced XML to a more complex structure for output -->
   <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" xsl-file="path/to/xsl"/>

   <object-to-string-transformer doc:name="Object to String"/>

   <!-- AT THIS POINT, THE PAYLOAD IS A STRING OF XML (payload=java.lang.String) -->

   <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="hello" contentType="text/xml" method="POST" doc:name="HTTP"/>
</flow>

我得到的错误如下:

ERROR 2014-05-08 10:39:41,449 [[processes].consignmentInputFileConnector.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8081/hello, connector=HttpConnector
{
  name=connector.http.mule.default
  lifecycle=start
  this=45f8d5e5
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[http]
  serviceOverrides=<none>
}
,  name='endpoint.http.localhost.8081.hello', mep=REQUEST_RESPONSE, properties={http.method=POST, Content-Type=text/xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: PostMethod
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Connection refused (java.net.ConnectException)
  java.net.PlainSocketImpl:-2 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=http://localhost:8081/hello, connector=HttpConnector
{
  name=connector.http.mule.default
  lifecycle=start
  this=45f8d5e5
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[http]
  serviceOverrides=<none>
}
,  name='endpoint.http.localhost.8081.hello', mep=REQUEST_RESPONSE, properties={http.method=POST, Content-Type=text/xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: PostMethod (org.mule.api.transport.DispatchException)
  org.mule.transport.http.HttpClientMessageDispatcher:155 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我在这里尝试实现的最终目标是评估从 HTTP 端点接收到的响应代码,然后进行相应的处理。但是,到目前为止,我一直无法成功发布。

【问题讨论】:

    标签: http exception mule mule-studio outbound


    【解决方案1】:

    你确定http://localhost:8081/hello 上有东西在收听吗? java.net.ConnectException 倾向于相反。

    【讨论】:

    • 有什么方法可以检查这个吗?我是使用 HTTP 端点的新手。在 Mac 上工作是否会有所作为?我使用这些凭据的原因是我遵循了 Mule 的 this 教程,了解如何使用 HTTP/HTTPS 连接器。
    • 试试:curl http://localhost:8081/hello。如果您收到回复,Mule 应该也能收到。
    • 感谢@David,看来我的 Apache 服务器正在侦听端口 80。我现在在 Mule 中得到的响应有更多问题(各种 400 错误)!如果我无法深入了解,将发布一个新问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-28
    • 1970-01-01
    • 1970-01-01
    • 2013-02-22
    • 1970-01-01
    • 2021-11-07
    • 1970-01-01
    相关资源
    最近更新 更多