Jenkins无法读取config.xml:哈德逊.安全性.全局矩阵授权策略hudson.安全性. LDAP安全领域

hi3rlvi2  于 2022-12-03  发布在  Jenkins
关注(0)|答案(1)|浏览(409)

使用Jenkins2.169
Jenkins服务器今天突然出现故障,错误如下:

SEVERE: Failed Loading global config
java.io.IOException: Unable to read /somewhere/jenkins/home/config.xml
    at hudson.XmlFile.unmarshal(XmlFile.java:181)
    at hudson.XmlFile.unmarshal(XmlFile.java:161)
    at jenkins.model.Jenkins.loadConfig(Jenkins.java:3043)
    at jenkins.model.Jenkins.access$1300(Jenkins.java:309)
    at jenkins.model.Jenkins$13.run(Jenkins.java:3145)
    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:1096)
    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:748)
    Caused by: jenkins.util.xstream.CriticalXStreamException: hudson.security.GlobalMatrixAuthorizationStrategy :   hudson.security.GlobalMatrixAuthorizationStrategy
    ---- Debugging information ----
    message             : hudson.security.GlobalMatrixAuthorizationStrategy
    cause-exception     :   com.thoughtworks.xstream.mapper.CannotResolveClassException
    cause-message       : hudson.security.GlobalMatrixAuthorizationStrategy
    class               : hudson.model.Hudson
    required-type       : hudson.model.Hudson
    converter-type      : hudson.util.RobustReflectionConverter
    path                : /hudson/authorizationStrategy
    line number         : 12
    version             : not available
    -------------------------------
    at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:354)
    at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:268)
    at  com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1189)
    at hudson.util.XStream2.unmarshal(XStream2.java:161)
    at hudson.util.XStream2.unmarshal(XStream2.java:132)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1173)
    at hudson.XmlFile.unmarshal(XmlFile.java:178)
    ... 12 more
    Caused by: com.thoughtworks.xstream.mapper.CannotResolveClassException: hudson.security.GlobalMatrixAuthorizationStrategy

发现罪魁祸首是两个丢失的插件:matrix-auth``matrix-auth
我可以恢复Jenkins,通过手动复制插件从另一个服务器.复制的文件:

jenkins/home/plugins/matrix-auth
jenkins/home/plugins/matrix-auth.jpi
jenkins/home/plugins/ldap
jenkins/home/plugins/ldap.jpi

首先,我安装了matrix-auth,然后我得到了以下错误,表明ldap也有问题:

Caused by: jenkins.util.xstream.CriticalXStreamException:
hudson.security.LDAPSecurityRealm : hudson.security.LDAPSecurityRealm
---- Debugging information ----
message             : hudson.security.LDAPSecurityRealm
cause-exception     :   
com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message       : hudson.security.LDAPSecurityRealm
class               : hudson.model.Hudson
required-type       : hudson.model.Hudson
converter-type      : hudson.util.RobustReflectionConverter
path                : /hudson/securityRealm
line number         : 53
version             : not available
-------------------------------

经过进一步的调查发现,很多插件被删除(而且,我找到了罪魁祸首,它与Jenkins无关)。所以解决方案的一部分是从另一个Jenkins服务器复制整个插件目录。

xfyts7mz

xfyts7mz1#

这是因为您的配置文件语法不正确。

sudo service jenkins stop

mv config.xml config.xml_bkp

sudo service jenkins start

这将修复它,因为它将在主服务器上的jenkins目录中创建新的config.xml

相关问题