启动Jenkins抛 unable to find valid certification path to requested target 错误

本文将解决在启动 jenkins 时抛出 unable to find valid certification path to requested target 错误信息。

在使用“java -jar jenkins.war --httpPort=8080”命令去启动 Jenkins 时,抛出了“unable to find valid certification path to requested target”错误信息。详细信息如下:

Running from: C:\Users\Administrator\Desktop\jenkins\jenkins.war

webroot: $user.home/.jenkins

2019-08-14 13:00:52.379+0000 [id=1]     INFO    org.eclipse.jetty.util.log.Log#initialized: Logging initialized @1250ms to org.eclipse.jetty.util.log.JavaUtilLog

2019-08-14 13:00:52.659+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file

2019-08-14 13:00:52.737+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath

2019-08-14 13:00:52.878+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-9.4.z-SNAPSHOT; built: 2019-05-02T00:04:53.875Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_45-b15

2019-08-14 13:00:53.939+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet

2019-08-14 13:00:54.079+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0

2019-08-14 13:00:54.079+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults

2019-08-14 13:00:54.095+0000 [id=1]     INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 600000ms Jenkins home directory: C:\Users\Administrator\.jenkins found at: $user.home/.jenkins

2019-08-14 13:00:55.483+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@10289886{Jenkins v2.189,/,file:///C:/Users/Administrator/.jenkins/war/,AVAILABLE}{C:\Users\Administrator\.jenkins\war}

2019-08-14 13:00:55.608+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@3fb6a447{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}

2019-08-14 13:00:55.608+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started @4491ms

2019-08-14 13:00:55.623+0000 [id=22]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine v4.0 running: controlPort=disabled

2019-08-14 13:00:59.523+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization

2019-08-14 13:00:59.664+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins

2019-08-14 13:01:02.862+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins

2019-08-14 13:01:02.877+0000 [id=28]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins

2019-08-14 13:01:02.909+0000 [id=30]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions

2019-08-14 13:01:04.734+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs

2019-08-14 13:01:05.030+0000 [id=47]    INFO    hudson.model.AsyncPeriodicWork$1#run: Started Download metadata

2019-08-14 13:01:05.233+0000 [id=47]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server

2019-08-14 13:01:06.122+0000 [id=47]    INFO    hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

        at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)

        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)

        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)

        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)

Caused: sun.security.validator.ValidatorException: PKIX path building failed

        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)

        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)

        at sun.security.validator.Validator.validate(Validator.java:260)

        at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)

        at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)

        at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)

        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1460)

Caused: javax.net.ssl.SSLHandshakeException

        at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)

        at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)

        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)

        at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)

        at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1478)

        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)

        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)

        at sun.security.ssl.Handshaker.process_record(Handshaker.java:914)

        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1050)

        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1363)

        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1391)

        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1375)

        at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)

        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)

        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)

        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)

        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)

        at hudson.model.DownloadService.loadJSON(DownloadService.java:167)

        at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:189)

        at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1762)

        at hudson.PluginManager$$Lambda$74/1218178490.call(Unknown Source)

        at hudson.util.Retrier.start(Retrier.java:62)

        at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1733)

        at jenkins.model.DownloadSettings$DailyCheck.execute(DownloadSettings.java:130)

        at hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:101)

        at java.lang.Thread.run(Thread.java:745)

这个错误是由于 jenkins 需要访问 https://updates.jenkins.io/update-center.json 地址去更新或者下载插件等。我们只需要将 https 改为 http即可。修改 C:\Users\Administrator\.jenkins\hudson.model.UpdateCenter.xml 文件,文件内容如下:

<?xml version='1.1' encoding='UTF-8'?>
<sites>
  <site>
    <id>default</id>
    <url>https://updates.jenkins.io/update-center.json</url>
  </site>
</sites>

修改后的文件内容如下:

<?xml version='1.1' encoding='UTF-8'?>
<sites>
  <site>
    <id>default</id>
    <url>http://updates.jenkins.io/update-center.json</url>
  </site>
</sites>

完成上面这些步骤后,然后重启 jenkins 即可。

有时候读书是一种巧妙地避开思考的方法。——赫尔普斯
5 不喜欢
说说我的看法 -
全部评论(

整了一天 不是大哥你  我就自杀去了

回复:

生命可贵,问题搞不定,放放再去,可能就搞定了

sb

回复:

请文明用语

关于
本网站专注于 Java、数据库(MySQL、Oracle)、Linux、软件架构及大数据等多领域技术知识分享。涵盖丰富的原创与精选技术文章,助力技术传播与交流。无论是技术新手渴望入门,还是资深开发者寻求进阶,这里都能为您提供深度见解与实用经验,让复杂编码变得轻松易懂,携手共赴技术提升新高度。如有侵权,请来信告知:hxstrive@outlook.com
公众号