当前位置: 首页 > 知识库问答 >
问题:

PKIX路径构建-NIFI在通过InvokeHTTP处理器调用API时出错[重复]

苍宝
2023-03-14

当我调用一个驻留在另一台服务器上的API时,我在NIFI中遇到以下错误。(源和目标是Linux服务器)

我需要在当前服务器中添加服务器证书来解决此问题。

有人能提供我需要执行的一步一步的命令来解决这个问题吗?

Nifi日志:

2021-05-11 16:56:40,619 ERROR [Timer-Driven Process Thread-4] o.a.nifi.processors.standard.InvokeHTTP InvokeHTTP[id=0176115c-90fb-164a-a491-7eb6554327bc] Routing to Failure due to exception: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at sun.security.ssl.Alert.createSSLException(Alert.java:131)
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:327)
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:270)
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:265)
        at sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:646)
        at sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:465)
        at sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:361)
        at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:376)
        at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:451)
        at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:428)
        at sun.security.ssl.TransportContext.dispatch(TransportContext.java:184)
        at sun.security.ssl.SSLTransport.decode(SSLTransport.java:154)
        at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1198)
        at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1107)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:400)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:372)
        at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:281)
        at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251)
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:195)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
        at okhttp3.RealCall.execute(RealCall.java:69)
        at org.apache.nifi.processors.standard.InvokeHTTP.onTrigger(InvokeHTTP.java:850)
        at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
        at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1174)
        at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
        at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
        at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
        at sun.security.validator.Validator.validate(Validator.java:271)
        at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:312)
        at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:221)
        at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:128)
        at sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:630)
        ... 43 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
        ... 49 common frames omitted

共有1个答案

沈自珍
2023-03-14

NiFi中的InvokeHTTP是API的客户机。这意味着InvokeHTTP需要能够信任远程服务器,以确保它没有连接到恶意服务。为此,我们需要将远程服务的证书颁发机构/根颁发机构添加到InvokeHTTP的信任库中。所需的CA将显示在服务的服务器证书的“颁发者”字段中。

要获取CA,您可以访问以下博客:https://daniel.haxx.se/blog/2018/11/07/get-the-ca-cert-for-curl/,并通过以下操作将CA检索到pem文件:

echo quit | openssl s_client -showcerts -servername server -connect server:443 > cacert.pem

然后,您可以使用密钥库资源管理器(https://keystore-explorer.org)创建一个新的信任库文件(这是管理密钥/信任库的一种简单得多的方法),并将证书cacert.pem导入到这个信任库中。

 类似资料:
  • 问题内容: 我正在与一个名为CommWeb的商户帐户集成,并向其URL(https://migs.mastercard.com.au/vpcdps)发送一个SSL帖子。当我尝试发送帖子时,出现以下异常: 执行该帖子的代码(我没有写过,并且已经存在于我们的代码库中)是: 商户帐户集成的文档对证书一无所知。他们确实提供了一些似乎盲目接受证书的示例JSP代码: 我们的Web应用程序有一个密钥库,我尝试使

  • 我正在使用一个自定义的工件库来部署我的项目。当我在本地机器上工作时,这很好,但我已经启用了Gitlab的AutoDevOps功能,并将我的项目与Kubernetes集群集成。 kubernetes集群由rancher管理。 问题是在Gitlab上运行的构建失败并出现以下错误: 插件org.apache.maven。插件:maven resources插件:2.6或其一个依赖项无法解析:无法读取or

  • Sun.Security.Validator.ValidatorException:PKIX路径生成失败:Sun.Security.Provider.CertPath.SunCertPathBuilderException:找不到请求目标的有效证书路径;嵌套异常为javax.net.ssl.sslHandShakeException:Sun.Security.Validator.Validator

  • 我刚刚为我们的域名购买了一个新的通配符ssl证书,因为我们的旧证书即将到期。我已经将它安装在我们的cas服务器和应用服务器上,但是我在我们的应用服务器上得到以下堆栈跟踪: 两个服务器上的证书是相同的。

  • 在将我的应用程序从Windows 2000移动到Windows 2008 R2服务器之后,我一直在努力让我的应用程序运行近一周。 程序如下: 已安装Java JDK 1.7.0_25 我试图用重复步骤3,以确保我没有搞砸任何事情。 上述方法并没有解决我的问题,所以我尝试以编程方式进行: 仍然没有任何运气。我被困住了,不太确定从这里往哪个方向走。 堆栈跟踪: 更新: 都是

  • 编辑:这个问题的第一个版本给人的印象是我的问题与Maven有关。我修改了措辞,以便更多地关注JDK。 我得到时,试图使用Java联系任何支持SSL的服务。对其他相关问题的回答并没有阻止我的错误。 null 众所周知的解决这个问题的方法似乎不起作用。我如何才能停止错误,修复我的JDK,并最终再次使用支持SSL的服务?