背景
需要更新jenkins的某個插件,安裝準備重啓時,報錯了,具體報錯如下:
# 只放上相關錯誤
java.io.IOException: Unable to read /data/jenkins/config.xml
Caused: jenkins.util.xstream.CriticalXStreamException: hudson.security.ProjectMatrixAuthorizationStrategy : hudson.security.ProjectMatrixAuthorizationStrategy
---- Debugging information ----
message : hudson.security.ProjectMatrixAuthorizationStrategy
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : hudson.security.ProjectMatrixAuthorizationStrategy
class : hudson.model.Hudson
required-type : hudson.model.Hudson
converter-type : hudson.util.RobustReflectionConverter
path : /hudson/authorizationStrategy
line number : 12
version : not available
解決過程
看報錯是權限的問題,百度谷歌了一圈,有個類似的答案是說:在plugins
下的matrix-auth
…這個文件夾是空的,需要刪除config.xml
後就可以進jenkins
了,然後再去插件管理裏安裝matrix-auth
即可。
但是我看了下plugins/matrix-auth下的WEBINFO裏是有東西的。並不爲空。我看到在plugins
下很多*.disabled
的文件,網上說,安裝一個插件就會在plugins
下新建一個文件夾和插件同名的文件。如果禁用插件,就會生成一個:..jpi.disabled 文件來標誌該插件禁用。
可能是因爲有些插件禁用的原因(至於爲什麼禁用,我不確定但是更新插件是否有亂點到),於是我通過命令把這個後綴爲disabled
的文件刪除了ls *.disabled | xargs rm -f
.刪除後,再次重啓jenkins
就進入了。
最後重啓jenkins我發現也有個坑。這臺服務器上有好多jenkis.一開始我用service jenkins restart
後沒有生效,我就stop了,但是發現服務還能通過url訪問。說明我stop的並非是這個。後來通過全局搜索Jenkins.war
文件,原來Jenkins放在了tomcat下的webapps,那就簡單了,重啓tomcat後,就生效了!