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

问题描述 投票:0回答:2

我有一个 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)

任何人都可以确定这里可能出了什么问题,或者建议一种在本地测试我的出站端点的替代方法吗?预先感谢。

http https mule mule-studio connector
2个回答
0
投票

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


0
投票

任何人都可以解决这个问题吗?请


消息:资源“https://transaction-sapi1.us-e2.cloudhub.io:443/api/members/transactions”上的 HTTP POST 失败:PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效认证路径。 元素:(无) 元素 DSL :(无) 错误类型:HTTP:CONNECTIVITY FlowStack:(无)

(为所有内容设置调试级别日志记录或“-Dmule.verbose.exceptions=true”)

© www.soinside.com 2019 - 2024. All rights reserved.