跳过正文
Background Image
  1. Posts/

Jenkins 升级后 Windows Agent 无法启动的解决方法

·325 字·1 分钟· ·
沈显鹏
作者
沈显鹏
目录

问题描述
#

在将团队的 Jenkins 从 2.235.1 升级到 2.263.3 后,发现 Windows Agent 无法启动,日志报错如下:

[windows-agents] Installing the Jenkins agent service
ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
java.lang.NullPointerException
    at hudson.os.windows.ManagedWindowsServiceLauncher.launch(ManagedWindowsServiceLauncher.java:298)

该问题已在 Jenkins Jira 上有反馈:


解决步骤
#

1. 更新 Windows Slaves 插件
#

windows-slaves-plugin 升级到 1.7 版本(支持 Jenkins 2.248+)。

更新后,如果仍出现如下错误:

ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
org.jinterop.dcom.common.JIException: Unknown Failure
    at org.jvnet.hudson.wmi.Win32Service$Implementation.start(Win32Service.java:149)

请继续执行下一步。


2. 修改 jenkins-agent.exe.config
#

找到 Jenkins agent 安装目录下的 jenkins-agent.exe.config 文件,注释或删除以下行:

<!-- <supportedRuntime version="v2.0.50727" /> -->

确保配置如下:

<configuration>
  <runtime>
    <generatePublisherEvidence enabled="false"/>
  </runtime>
  <startup>
    <supportedRuntime version="v4.0" />
  </startup>
</configuration>

如果存在 jenkins-slave.exe.config 文件,也需同样修改。


3. 检查 .NET Framework 版本
#

如果启动时提示:

.NET Framework 2.0 or later is required on this computer to run a Jenkins agent as a Windows service

则需要升级本机的 .NET Framework。 可参考:更新 .NET Framework


总结
#

通过 更新插件 + 修改配置文件 + 升级 .NET Framework,即可解决 Jenkins 升级后 Windows Agent 无法启动的问题。

相关文章

如何通过 Jenkins 进行资源的锁定和释放
·901 字·2 分钟
本文介绍了如何使用 Jenkins 的 Lockable Resources 插件来管理和锁定资源,确保在多任务环境中资源的独占性和安全性。
通过 Jenkins 来提交修改的代码 git push by Jenkins
·439 字·1 分钟
如何通过 Jenkins Pipeline 脚本来提交修改的代码到 Git 仓库,包括克隆仓库、修改代码和推送更改等步骤。
Jenkins Linux Agent 配置
·353 字·1 分钟
本文提供了 Jenkins Linux Agent 的逐步配置指南,包括 Java 运行时的准备、节点创建以及常见问题的排查方法。
Jenkins Windows Agent 配置
·608 字·2 分钟
本文提供 Jenkins Windows Agent 的详细配置步骤,包括 Java 运行时准备、节点创建以及常见问题的排查方法。
Jenkinsfile 配置
·256 字·1 分钟
本文介绍了如何使用 Jenkinsfile 配置 Jenkins Pipeline,包括构建、测试和发布阶段的示例,以及如何处理邮件通知。
Jenkins 中 `result` 与 `currentResult` 的区别
·492 字·1 分钟
本文解释了 Jenkins Pipeline 中 result 与 currentResult 的区别,并通过 Declarative Pipeline 与 Scripted Pipeline 示例展示它们在不同阶段的表现。