启动jenkins解锁后,报错“Failed to update the default Update Site 'default'”

报错信息:
// 报错信息

2019-11-05 02:01:43.970+0000 [id=40]    INFO    hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2662)
        at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2584)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1770)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        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.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)
2019-11-05 02:01:43.971+0000 [id=40]    INFO    hudson.util.Retrier#start: Calling the listener of the allowed exception 'connect timed out' at the attempt #1 to do the action check updates server
2019-11-05 02:01:43.977+0000 [id=40]    INFO    hudson.util.Retrier#start: Attempted the action check updates server for 1 time(s) with no success
2019-11-05 02:01:43.985+0000 [id=27]    WARNING hudson.model.UpdateCenter#updateDefaultSite: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2662)
        at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2584)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1770)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        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.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2456)
        at jenkins.install.SetupWizard.init(SetupWizard.java:168)
        at jenkins.install.InstallState$InitialSecuritySetup.initializeState(InstallState.java:166)
        at jenkins.model.Jenkins.setInstallState(Jenkins.java:1089)
        at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:96)
        at jenkins.install.InstallState$Unknown.initializeState(InstallState.java:84)
        at jenkins.model.Jenkins$16.run(Jenkins.java:3277)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
        at jenkins.model.Jenkins$5.runTask(Jenkins.java:1118)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
2019-11-05 02:01:44.018+0000 [id=40]    SEVERE  hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: SocketTimeoutException: connect timed out
2019-11-05 02:01:44.058+0000 [id=40]    INFO    hudson.model.AsyncPeriodicWork$1#run: Finished Download metadata. 36,249 ms
2019-11-05 02:01:44.078+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization

看到最后报错是因为

2019-11-05 02:01:43.985+0000 [id=27]    WARNING hudson.model.UpdateCenter#updateDefaultSite: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
java.net.SocketTimeoutException: connect timed out

找到相关的配置文件

[root@auto-server02 jenkins]# cat /var/lib/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>

考虑是url问题,修改为国内的源,也有朋友说是https的问题, 建议改为http,经过验证, 不是这个的原因,还是要修改源,如下:

[root@auto-server02 jenkins]# vi /var/lib/jenkins/hudson.model.UpdateCenter.xml

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

重启Jenkins

systemctl  restart jenkins

此时再去登录jenkins,插件可以正确显示 , 报错不在存在,问题解决。

Pbds全称为Perfectly Balanced Red-Black Tree,是一种平衡查找树的数据结构,它是C++标准库中的`<ext/pb_ds/rb_tree>`模块提供的一种高级模板容器,主要用于高效地存储和查找数据。它是在红黑树基础上进行了优化,保证了常数级的平均时间复杂度。 **特点:** 1. **自平衡**:插入、删除操作后的调整过程保证了树的高度最大为log(n),这使得查询操作的时间复杂度保持在O(log n)。 2. **内存效率高**:支持迭代器,可以像普通的数组或vector一样访问元素。 3. **模板化**:适用于各种数据类型,并支持自定义比较函数。 **实践示例(C++17开始引入std::any,旧版本需第三方库如Boost):** ```cpp #include <ext/pb_ds/tree_policy.hpp> // 引入PBDS策略 using namespace __gnu_pbds; // 使用namespace // 定义一个关联值类型的树模板,键为int,值为std::string template <typename K, typename V> using rb_tree = tree<K, null_type, less<K>, rb_tree_tag, tree_order_statistics_node_update>; int main() { // 创建一个rb_tree实例 rb_tree<int, std::string> myTree; // 插入元素 myTree.insert({5, "Hello"}); myTree.insert({10, "World"}); // 查找最小值 auto it = myTree.begin(); if (it != myTree.end()) { std::cout << "Smallest key is " << *it.first << " with value " << it->second << &#39;\n&#39;; } // 计算第3大的值 auto third_largest = myTree.order_of_key(3); // 获取值为3之前的所有节点个数 if (third_largest > 0) { it = myTree.lower_bound(third_largest); if (it != myTree.end()) { std::cout << "Third largest key is " << *it.first << " with value " << it->second << &#39;\n&#39;; } } return 0; } ``` **相关问题--:** 1. Pbds的红黑树相比标准的红黑树有哪些优势? 2. 如何使用Pbds的rb_tree进行范围查找? 3. 在实际项目中,何时会选择使用Pbds而不是普通的二叉搜索树?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值