[Jenkins]初次访问Jenkins,输入密码后,页面卡在空
问题描述
安装Jenkins,初次访问Jenkins(http://localhost:8002,端口号根据各自设置而不同,本例是8002),输入Jenkins初始化的管理密码之后,浏览器中一直卡在空白界面中,没有内容加载出来


问题分析
F12查看浏览器中的Request和Response情况:
从Request URL中初步分析可能是想要通过updateCenter站点进行更新安装Jenkins所需的一些组件;一直不间断的发送请求,更新站点的状态值始终为"CHECKING",一直没有获取到服务器响应有效内容。

搜寻网络上已有Blog,可能的原因有几种:
①$JENKINS_HOME/hudson.model.UpdateCenter.xml
文件中的服务器地址需要修改为可访问和正常响应的url
②对Jenkins配置满权限(chmod 777 ...)
③编辑/var/lib/jenkins/config.xml
文件,替换其中的authorizationStrategy、securityRealm标签中的class内容
④https证书原因,or所在地区网络原因,导致https的服务器url不能被正确识别返回有效内容
=====
对以上①-③的可操作性表示怀疑,是否是因为各自安装版本和方式不同的原因,暂时没有找到对应的操作;第④种可能性正好是比较靠谱的,网络上好心的前辈已经探索过其可行性ok(文末参考来源引用有对应Blog链接)
解决方案
参考以上分析的第④种可能性进行具体化操作
在正常启动Jenkins和Tomcat服务的前提下,在http://localhost:8002打开的页面中输入正确管理员密码之后,可在浏览器中另外新建几个Tab窗口,然后直接访问以下url地址:
Jenkins插件管理界面==> http://localhost:8002/pluginManager
Jenkins插件管理-高级设置界面==> http://localhost:8002/pluginManager/advanced


在Jenkins插件管理-高级设置界面,定位到页面最底部中的【升级站点】模块,将对应URL输入框中的url的https修改为http,即http://updates.jenkins.io/update-center.json
,然后点击【提交】保存修改项


从服务列表中关闭jenkins-->然后再启动jenkins-->启动Tomcat服务
PS:
1.服务列表查看:Win+R-->cmd命令taskmgr
-->Windows任务管理器:切换顶部功能标签为【服务】

2.若启动jenkins失败,可能是端口号被占用,需要修改之后再启用。修改端口号方法:jenkins目录下输入cmd命令java -jar jenkins.war --httpPort=xxx端口号
此时,再次访问Jenkins(http://localhost:8002),请耐心稍等一会儿。。。即可出现安装Jenkins插件的提示页面,如下:




参考来源:
[1] 安装Jenkins时不能联网安装插件问题解决
[2] jenkins可选插件为空的解决方式