一.Jenkins不能下载插件 报错sun.security.provider.certpath.SunCertPathBuilderException
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:1351) Caused: javax.net.ssl.SSLHandshakeException at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1369) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:156) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:925) at sun.security.ssl.Handshaker.process_record(Handshaker.java:860) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355) 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:1511) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at hudson.model.UpdateCenter$UpdateCenterConfiguration.testConnection(UpdateCenter.java:1406) Caused: java.io.IOException: Failed to validate the SSL certificate of https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json?uctest at hudson.model.UpdateCenter$UpdateCenterConfiguration.testConnection(UpdateCenter.java:1418) at hudson.model.UpdateCenter$UpdateCenterConfiguration.checkUpdateCenter(UpdateCenter.java:1189) at hudson.model.UpdateCenter$ConnectionCheckJob.run(UpdateCenter.java:1638) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:118) at java.lang.Thread.run(Thread.java:745)
解决方法:
1.更新站点
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
2.下载插件Skip Certificate Check的安装文件
https://plugins.jenkins.io/skip-certificate-check/
3.在Jenkins离线安装插件
还是刚刚更换站点的那个页面,把刚刚下载下来的文件上传然后点击deploy即可
安装完成后重启Jenkins即可解决
二.jenkins启动失败: jenkins: failed to find a valid Java installation
解决办法
首先要确保java环境变量可以用
1.查看java环境变量的命令
which java
2.检查配置文件
vim /etc/init.d/jenkins
vim /etc/sysconfig/jenkins
检查配置文件中的JAVA环境变量是否都配置正确, 如果有问题就更改为正确的 , 然后执行如下命令使配置重新生效
systemctl daemon-reload
如果配置正确 , 也可以执行上面的命令 , 然后重启 , 如果还是启动失败 , 并且通过
journalctl -xe
命令看到报错
那么可以使用ln -s的方式建立软连接
3.建立软连接
ln -s /usr/local/jdk/jdk1.8/bin/java /usr/bin/java
4.重新载入配置
systemctl daemon-reload
5.重启Jenkins
systemctl start jenkins
其他更多的Jenkins操作可以看我的其他博客 :
服务搭建篇(九) 使用GitLab+Jenkins搭建CI\CD执行环境 (上) 基础环境搭建
服务搭建篇(十) 使用GitLab+Jenkins搭建CI\CD执行环境 (下) 配置整合