Mule - 尝试通过HTTPS发送消息时“无法找到请求目标的有效证书路径”

时间:2014-06-05 12:41:10

标签: http https mule mule-studio connector

我有一个Mule流程(Mule CE 3.4.0,Studio 3.5.0),它正在处理一些XML并使用HTTPS端点将其发布到Web服务,如下所示:

<flow>
    <!-- Process XML -->
    <https:outbound-endpoint address="https://admin:password@localhost:8081/hello" exchange-pattern="request-response" contentType="text/xml" method="POST" doc:name="HTTP"/>
    <!-- Evaluate response -->
</flow>

在生产中,这将触及由不同平台公开的Web服务,但为了在本地进行测试,我创建了一个完全独立的Mule应用程序(单独的工作空间,项目文件等),公开了HTTPS端点以使用消息:

<spring:beans>
    <security:authentication-manager alias="MyManager">
        <security:authentication-provider>
            <security:user-service id="UserService">
                <security:user name="admin" password="password" authorities="ROLE_ADMIN"/>
            </security:user-service>
        </security:authentication-provider>
    </security:authentication-manager> 
</spring:beans>

<spring-security:security-manager>
    <spring-security:delegate-security-provider name="InMemory" delegate-ref="MyManager"/>
</spring-security:security-manager>

<https:connector name="httpsConnector">
    <https:tls-key-store path="test.jks" keyPassword="test1234" storePassword="test1234"/>
</https:connector>

<flow name="httpTestFlow" doc:name="httpTestFlow">
    <https:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" doc:name="HTTP" connector-ref="httpsConnector">
        <spring-security:http-security-filter realm="mule-realm" securityProviders="InMemory"/>
    </https:inbound-endpoint>
    <object-to-string-transformer doc:name="Object to String"/>
    <logger level="INFO" message="The XML message received is: #[payload]" doc:name="Logger"/>
</flow>

当我尝试运行此代码时,我的Mule应用程序(发送XML的应用程序)中出现以下错误:

********************************************************************************
Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=https://admin:<password>@localhost/hello, connector=HttpsConnector
{
  name=connector.https.mule.default
  lifecycle=start
  this=7cc4f42c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[https]
  serviceOverrides=<none>
}
,  name='endpoint.https.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. unable to find valid certification path to requested target (sun.security.provider.certpath.SunCertPathBuilderException)
  sun.security.provider.certpath.SunCertPathBuilder:196 (null)
2. PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (sun.security.validator.ValidatorException)
  sun.security.validator.PKIXValidator:385 (null)
3. sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (javax.net.ssl.SSLHandshakeException)
  sun.security.ssl.Alerts:192 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/net/ssl/SSLHandshakeException.html)
4. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=https://admin:<password>@localhost/hello, connector=HttpsConnector
{
  name=connector.https.mule.default
  lifecycle=start
  this=7cc4f42c
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[https]
  serviceOverrides=<none>
}
,  name='endpoint.https.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:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

我的其他应用程序收到消息时出现此错误:

ERROR 2014-06-05 15:58:05,380 [[test-webservice].http.request.dispatch.8081.01] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: Received fatal alert: certificate_unknown
javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1822)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1004)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:818)
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:50)
    at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
    at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
    at org.mule.transport.http.HttpServerConnection.readLine(HttpServerConnection.java:243)
    at org.mule.transport.http.HttpServerConnection.getRequestLine(HttpServerConnection.java:509)
    at org.mule.transport.http.HttpRequestDispatcherWork.run(HttpRequestDispatcherWork.java:70)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)

任何人都可以确定此处可能出现的问题,或建议在本地测试我的出站端点的替代方法吗?提前谢谢。

1 个答案:

答案 0 :(得分:0)

您确定您的单独应用程序实际上正在运行吗?它看起来不是:也许它只是无法启动?