Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CannotResolveClassException for ProjectMatrixAuthorizationStrategy

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 ?

like image 787
user2991413 Avatar asked Jun 22 '17 06:06

user2991413


3 Answers

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/).

like image 180
Daniel Beck Avatar answered Nov 12 '22 23:11

Daniel Beck


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"
like image 24
hit3k Avatar answered Nov 12 '22 22:11

hit3k


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.

like image 1
smido Avatar answered Nov 12 '22 21:11

smido