jenkins启动报错:Failed Loading global config
问题起因:
想在构建项目中使用复选框(Extended Choice Parameter),需要安装Extended Choice Parameter插件,但是因为版本过低的原因,导致插件无法正常安装。然后根据提示,就在jenkins的web页面进行了自动升级。
但是在升级过程中,平台就挂掉了,去jenkins服务器上去查看日志,发现是因为升级后,jdk的版本不匹配jenkins的版本导致,这里也是个坑,自动升级平台时没有去检查JDK版本的问题。
更换了jdk版本后,jenkins任然无法正常启动,报错:
2024-01-16 10:09:50.556+0000 [id=34] SEVERE jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading global config com.thoughtworks.xstream.mapper.CannotResolveClassException: hudson.security.GlobalMatrixAuthorizationStrategy at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:81) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at hudson.util.XStream2$CompatibilityMapper.realClass(XStream2.java:411) at hudson.util.xstream.MapperDelegate.realClass(MapperDelegate.java:46) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47) at hudson.util.RobustReflectionConverter.determineType(RobustReflectionConverter.java:521) at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:346) Caused: jenkins.util.xstream.CriticalXStreamException: ---- Debugging information ---- 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 : 8 version : not available ------------------------------- at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:381) at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:289) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:74) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:68) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:52) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:136) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1421) at hudson.util.XStream2.unmarshal(XStream2.java:189) at hudson.util.XStream2.unmarshal(XStream2.java:160) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1399) at hudson.XmlFile.unmarshal(XmlFile.java:196) Caused: java.io.IOException: Unable to read /root/.jenkins/config.xml at hudson.XmlFile.unmarshal(XmlFile.java:199) at hudson.XmlFile.unmarshal(XmlFile.java:179) at jenkins.model.Jenkins.loadConfig(Jenkins.java:3296) at jenkins.model.Jenkins.access$1200(Jenkins.java:340) at jenkins.model.Jenkins$12.run(Jenkins.java:3398) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1158) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:222) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 2024-01-16 10:09:50.563+0000 [id=21] SEVERE hudson.util.BootFailure#publish: Failed to initialize Jenkins com.thoughtworks.xstream.mapper.CannotResolveClassException: hudson.security.GlobalMatrixAuthorizationStrategy at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:81) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:55) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.PackageAliasingMapper.realClass(PackageAliasingMapper.java:88) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:79) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:74) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.SecurityMapper.realClass(SecurityMapper.java:71) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at hudson.util.XStream2$CompatibilityMapper.realClass(XStream2.java:411) at hudson.util.xstream.MapperDelegate.realClass(MapperDelegate.java:46) at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:125) at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:47) at hudson.util.RobustReflectionConverter.determineType(RobustReflectionConverter.java:521) at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:346) Caused: jenkins.util.xstream.CriticalXStreamException: ---- Debugging information ---- 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 : 8 version : not available ------------------------------- at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:381) at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:289) at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:74) at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:72) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:68) at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:52) at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:136) at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1421) at hudson.util.XStream2.unmarshal(XStream2.java:189) at hudson.util.XStream2.unmarshal(XStream2.java:160) at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1399) at hudson.XmlFile.unmarshal(XmlFile.java:196) Caused: java.io.IOException: Unable to read /root/.jenkins/config.xml at hudson.XmlFile.unmarshal(XmlFile.java:199) at hudson.XmlFile.unmarshal(XmlFile.java:179) at jenkins.model.Jenkins.loadConfig(Jenkins.java:3296) at jenkins.model.Jenkins.access$1200(Jenkins.java:340) at jenkins.model.Jenkins$12.run(Jenkins.java:3398) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:175) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305) at jenkins.model.Jenkins$5.runTask(Jenkins.java:1158) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:222) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused: org.jvnet.hudson.reactor.ReactorException at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:291) at jenkins.InitReactorRunner.run(InitReactorRunner.java:49) at jenkins.model.Jenkins.executeReactor(Jenkins.java:1193) at jenkins.model.Jenkins.<init>(Jenkins.java:983) at hudson.model.Hudson.<init>(Hudson.java:86) at hudson.model.Hudson.<init>(Hudson.java:82) at hudson.WebAppMain$3.run(WebAppMain.java:247) Caused: hudson.util.HudsonFailedToLoad at hudson.WebAppMain$3.run(WebAppMain.java:264)
解决方法:
备份/root/.jenkins/config.xml文件,然后将/root/.jenkins/config.xml文件中的<authorizationStrategy>和 <useSecurity>这2个标签删掉,然后重启。
总结:
因为在平时正常的操作中,很可能会忽略其他可能发生的问题,第一个是升级jenkins平台后它所依赖的JDK版本问题,第二个问题应该是个坑,平台自动升级了后会出现配置读取的问题。
如果要升级或者迁移jenkins,首先要备份jenkins版本信息或者程序包,还要备份/root/.jenkins/目录,然后要注意JDK的版本问题。
官方提供的JDK版本与jenkins版本兼容的信息,可以参考。
https://www.jenkins.io/doc/book/platform-information/support-policy-java/
标签:Loading,java,global,xstream,报错,jenkins,hudson,com,thoughtworks From: https://www.cnblogs.com/NanZhiHan/p/17969251