I was trying to restore jenkins on a new machine by tacking up backup from old machine . I replaced the jenkins home directory of new machine from old one. When i launch jenkins it gives me this error.
Caused: java.io.IOException: Unable to read /var/lib/jenkins/config.xml
There is also
Caused: hudson.util.HudsonFailedToLoad
Caused: org.jvnet.hudson.reactor.ReactorException
Debug info is ---- 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 : 11
version : not available
-------------------------------
This is what my config.xml look like
<useSecurity>true</useSecurity>
<authorizationStrategy class="hudson.security.ProjectMatrixAuthorizationStrategy">
<permission>hudson.model.Hudson.Administer:visha</permission>
</authorizationStrategy>
Can someone please help ?
This usually happens when the plugin providing the authorization strategy is not installed or enabled.
Make sure the matrix-auth
plugin is installed and that it's not disabled (no matrix-auth.jpi.disabled
file (or similar) in $JENKINS_HOME/plugins/
).
It can happen if a newer version of a plugin is incompatible with older version of Jenkins. It's recommended to upgrade Jenkins to latest version.
This is how I do it:
ssh jenkins "cd /tmp; wget https://updates.jenkins-ci.org/latest/jenkins.war"
ssh jenkins "cp /usr/share/jenkins/jenkins.war /tmp/jenkins.war.previous.version"
ssh jenkins "sudo systemctl status jenkins"
ssh jenkins "sudo cp /tmp/jenkins.war /usr/share/jenkins/"
ssh jenkins "sudo systemctl restart jenkins"
If you cannot even log in because of this error, you can disable security in jenkins config file /config.xml.
Search for <useSecurity>true</useSecurity>
and change the value to false
. Then restart jenkins from command line and you should be able to login and make change to plugin/auth configurations as suggested in other answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With