Mule - 无法通过HTTPS端点路由

时间:2014-08-29 12:31:58

标签: mule

我有一个带有HTTPS入站请求/响应的流,它接受带有XML数据的帖子(端口8081)。我对数据进行了一些处理,然后想要通过443执行另一个HTTPS帖子到不同的URL,以便数据由外部进程(PeopleSoft IB)处理。

问题在于,当我尝试发布到HTTPS:443 outbound从HTTPS传入的内容:8081入站时,我收到如下所示的错误。

但是,如果我将入站连接器设置为HTTP且不是 HTTPS并注释掉https:连接器名称=" httpsConnector"我有设置,一切都很完美,我可以发布到HTTPS / 443端点。

我已经搜索过高低,尝试了很多不同的事情来尝试解决这个错误,但到目前为止所有的尝试都失败了。我知道它与有效载荷有关,因为MuleSoft正在跟踪并且从不路由到HTTPS端点。我通过将有效负载更改为纯文本并且已成功发送来确认了这一点。它也像我上面提到的那样成功发送,当我以HTTP到8081进入入站时。

我是MuleSoft的新手,所以如果这是一个简单的解决方案,请原谅我的无知。

错误摘要

Failed to route event via endpoint:  
DefaultOutboundEndpoint{endpointUri=https://corp853.dev.corp.edu:443/PSIGW
/HttpListeningConnector, connector=HttpsConnector { name=httpsConnector lifecycle=start  
this=3a2b2faa numberOfConcurrentTransactedReceivers=4 
createMultipleTransactedReceivers=true connected=true supportedProtocols=[https] 
serviceOverrides= session.handler=org.mule.session.NullSessionHandler 
message.factory=org.mule.transport.http.HttpMuleMessageFactory } , 
name='endpoint.https.corp853.dev.corp.edu.443.PSIGW.HttpListeningConnector', 
mep=REQUEST_RESPONSE, properties={exceptionOnMessageError=true, http.method=POST}, 
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

捕捉错误

Could not find a transformer to transform
"SimpleDataType{type=org.apache.commons.httpclient.methods.PostMethod,
mimeType='text/xml'}" to "SimpleDataType{type=org.mule.api.transport.OutputHandler,  
mimeType='*/*'}". (org.mule.api.transformer.TransformerException) 
(org.mule.api.transformer.TransformerException). The current MuleMessage is null! Please 
report this to dev@mule.codehaus.org 
(org.mule.api.transformer.TransformerMessagingException). Message payload is of type: 
PostMethod

记录明细

+ Started app 'checklisttest'                              +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO  2014-08-29 04:20:04,623 [[checklisttest].httpsConnector.receiver.02] org.mule.api.processor.LoggerMessageProcessor: 
org.mule.DefaultMuleMessage
{
  id=6cca1ad0-2f6e-11e4-89b1-001c42000009
  payload=org.apache.commons.httpclient.ContentLengthInputStream
  correlationId=<not set>
  correlationGroup=-1
  correlationSeq=-1
  encoding=UTF-8
  exceptionPayload=<not set>

Message properties:
  INVOCATION scoped properties:
    Content-Type=text/xml
  INBOUND scoped properties:
    Accept=*/*
    Accept-Encoding=gzip,deflate
    Accept-Language=en-US,en;q=0.8
    Cache-Control=no-cache
    Connection=true
    Content-Length=632
    Content-Type=text/xml
    Host=localhost:8082
    Keep-Alive=true
    MULE_ORIGINATING_ENDPOINT=endpoint.https.localhost.8082.checklist.v1
    MULE_REMOTE_CLIENT_ADDRESS=/127.0.0.1:56585
    Origin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
    Postman-Token=721feb2b-281c-382e-169d-2c2792153944
    User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36
    http.context.path=/checklist_v1
    http.context.uri=https://localhost:8082/checklist_v1
    http.headers={Origin=chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop, Keep-Alive=true, Accept=*/*, Connection=true, User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36, Host=localhost:8082, Accept-Encoding=gzip,deflate, Cache-Control=no-cache, Postman-Token=721feb2b-281c-382e-169d-2c2792153944, Accept-Language=en-US,en;q=0.8, Content-Length=632, Content-Type=text/xml}
    http.method=POST
    http.query.params={}
    http.query.string=
    http.relative.path=
    http.request=/checklist_v1
    http.request.path=/checklist_v1
    http.version=HTTP/1.1
  OUTBOUND scoped properties:
    LOCAL_CERTIFICATES=[Ljava.security.cert.X509Certificate;@59884baf
    MULE_ENCODING=UTF-8
  SESSION scoped properties:
}
INFO  2014-08-29 04:20:04,636 [[checklisttest].httpsConnector.receiver.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO  2014-08-29 04:20:04,642 [[checklisttest].httpsConnector.receiver.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default response transformer: org.mule.transport.http.transformers.MuleMessageToHttpResponse
INFO  2014-08-29 04:20:04,643 [[checklisttest].httpsConnector.receiver.02] org.mule.transport.service.DefaultTransportServiceDescriptor: Loading default outbound transformer: org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest
INFO  2014-08-29 04:20:04,643 [[checklisttest].httpsConnector.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'httpsConnector.dispatcher.699512478'. Object is: HttpsClientMessageDispatcher
INFO  2014-08-29 04:20:04,645 [[checklisttest].httpsConnector.receiver.02] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'httpsConnector.dispatcher.699512478'. Object is: HttpsClientMessageDispatcher
INFO  2014-08-29 04:20:04,660 [[checklisttest].httpsConnector.receiver.02] org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest: Content-Type not set on outgoing request, defaulting to: text/plain
ERROR 2014-08-29 04:20:04,698 [[checklisttest].httpsConnector.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=https://corp853.dev.corp.edu:443/PSIGW/HttpListeningConnector, connector=HttpsConnector
{
  name=httpsConnector
  lifecycle=start
  this=3a2b2faa
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[https]
  serviceOverrides=
    session.handler=org.mule.session.NullSessionHandler
    message.factory=org.mule.transport.http.HttpMuleMessageFactory
}
,  name='endpoint.https.corp853.dev.corp.edu.443.PSIGW.HttpListeningConnector', mep=REQUEST_RESPONSE, properties={exceptionOnMessageError=true, http.method=POST}, 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. The server corp853.dev.corp.edu failed to respond (org.apache.commons.httpclient.NoHttpResponseException)
  org.apache.commons.httpclient.HttpMethodBase:1976 (null)
2. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=https://corp853.dev.corp.edu:443/PSIGW/HttpListeningConnector, connector=HttpsConnector
{
  name=httpsConnector
  lifecycle=start
  this=3a2b2faa
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[https]
  serviceOverrides=
    session.handler=org.mule.session.NullSessionHandler
    message.factory=org.mule.transport.http.HttpMuleMessageFactory
}
,  name='endpoint.https.corp853.dev.corp.edu.443.PSIGW.HttpListeningConnector', mep=REQUEST_RESPONSE, properties={exceptionOnMessageError=true, http.method=POST}, 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:151 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.apache.commons.httpclient.NoHttpResponseException: The server corp853.dev.corp.edu failed to respond
        at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
        at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我的项目XML是:

    <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:https="http://www.mulesoft.org/schema/mule/https" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd">
<https:connector name="httpsConnector" clientSoTimeout="10000"
    cookieSpec="netscape" doc:name="HTTP-HTTPS" proxyHostname="localhost"
    receiveBacklog="0" receiveBufferSize="0" sendBufferSize="0"
    serverSoTimeout="10000" socketSoLinger="0" validateConnections="true">
    <service-overrides messageFactory="org.mule.transport.http.HttpMuleMessageFactory" 
        sessionHandler="org.mule.session.NullSessionHandler" />
    <https:tls-client path="${corp.folder}/conf/mulekeystore.jks"
        storePassword="pwd" />
    <https:tls-key-store path="${corp.folder}/conf/mulekeystore.jks"
        keyPassword="pwd" storePassword="pwd" />
    <https:tls-server path="${corp.folder}/conf/mulekeystore.jks"
        storePassword="pwd" />
</https:connector>
<spring:beans>
    <spring:bean id="corpProperties"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <spring:property name="ignoreUnresolvablePlaceholders"
            value="true" />
        <spring:property name="location" value="classpath:custom.properties" />
        <!-- Added to support multiple placeholders -->
    </spring:bean>
</spring:beans>
<flow name="checklisttestFlow1" doc:name="checklisttestFlow1">
    <https:inbound-endpoint exchange-pattern="request-response"
        host="localhost" port="8082" doc:name="HTTP" contentType="text/xml"
        connector-ref="httpsConnector" path="checklist_v1" />
    <logger level="INFO" doc:name="Logger" />
    <https:outbound-endpoint exchange-pattern="request-response"
        host="corp853.dev.corp.edu" port="443" path="PSIGW/HttpListeningConnector"
        method="POST" doc:name="HTTP" />
</flow>
</mule>

2 个答案:

答案 0 :(得分:1)

对于所有好奇的人来说,这个问题归结为为密码库配置了适用于HTTPS出站端点的证书。这是在MuleSoft支持的帮助下发现的。

如何做到这一点是:

  1. 将log4j.logger.httpclient.wire = DEBUG添加到log4j.properties,然后将此文件添加到src / main / resources(我在本地运行)
  2. 从HTTPS出站连接器中删除localhost作为代理
  3. 这显示了跟踪中的以下内容,清楚地显示了问题所在。

    Root Exception stack trace:
    sun.security.validator.ValidatorException: No trusted certificate found
    at sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator.java:344)
    at sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:109)
    at sun.security.validator.Validator.validate(Validator.java:218)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
    

    我以前没有与HTTPS出站连接器关联的密钥库(我使用入站连接),因为当我以HTTP身份进入,然后以HTTPS身份出现时,需要。我发现,经过很多痛苦后,需要一个密钥库 ,入站为HTTPS,出站为HTTPS。

    在这个出站HTTPS密钥库中,我添加了网站的证书(PeopleSoft集成代理的监听连接器),一切都很顺利。

答案 1 :(得分:-1)

我从未见过这个确切的错误,但我想我知道什么可以提供帮助。尝试在https入站端点后添加对象到字符串转换器。