通过Jenkins GUI创建的节点编辑配置时报错,config.xml中<nodeProperties>值异常
通过Jenkins GUI创建的节点编辑配置时报错,config.xml中值异常
我最近碰到了和你完全一样的问题,节点刚创建完能正常连接跑任务,结果一点编辑配置就报错,折腾了好一阵才找到问题根源,分享给你:
问题现象
- 用Jenkins GUI新建永久节点(不是复制现有节点),节点能正常连接、状态显示一切正常
- 但点击「配置」按钮编辑节点时,页面直接抛出错误:
A problem occurred while processing the request, Logging ID=f10cac89-d3a5-47fd-9598-cf08f6b39ba0
查看Jenkins日志得到的错误栈
Caught unhandled exception with ID f10cac89-d3a5-47fd-9598-cf08f6b39ba0 java.lang.NullPointerException: Cannot invoke "hudson.model.Describable.getDescriptor()" because "t" is null at hudson.util.DescribableList.get(DescribableList.java:134) at hudson.util.DescribableList.rebuild(DescribableList.java:175) at hudson.model.Node$1.onConvert(Node.java:590) at hudson.model.Descriptor$NewInstanceBindInterceptor.onConvert(Descriptor.java:740) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:777) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:620) at org.kohsuke.stapler.RequestImpl.injectSetters(RequestImpl.java:1046) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:990) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:861) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:620) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:615) at hudson.model.Descriptor.bindJSON(Descriptor.java:662) at hudson.model.Descriptor.newInstanceImpl(Descriptor.java:620) Caused: java.lang.LinkageError: Failed to instantiate class hudson.slaves.DumbSlave from {...}
排查发现的核心问题
我去Jenkins主目录下的~jenkins/nodes/[你的节点名]/config.xml里一看,发现<nodeProperties>标签的内容明显不对:
<nodeProperties> <null/> </nodeProperties>
正常情况下,没有自定义节点属性的节点,这里应该是空标签:<nodeProperties/>
解决步骤
- 先确保这个节点没有在运行任务,或者临时停掉Jenkins服务(避免修改配置时冲突)
- 找到对应节点的
config.xml文件,修改<nodeProperties>部分:
把带<null/>的代码块改成空标签:<nodeProperties/> - 保存文件后,重启Jenkins(或者在Jenkins后台刷新节点配置)
- 再去编辑节点配置,就不会再报错了
推测的原因
这个问题应该是插件兼容性导致的——从错误日志里的hudson-plugins-jobConfigHistory-NodeLocalConfiguration来看,大概率是Job Config History插件和SSH Slaves插件的组合,在节点创建时把空的nodeProperties错误序列化成了<null/>,而Jenkins在解析这个无效配置时触发了空指针异常。
内容来源于stack exchange
相关产品推荐
相关产品推荐

