Cannot Resolve Class Exception: hudson. security. Global Matrix Authorization Strategy

Lately I’ve been getting this error whenever I quit Jenkins altogether and restart it:
“com.thoughtworks.xstream.mapper.CannotResolveClassException: hudson.security.GlobalMatrixAuthorizationStrategy”

I think it has been happening since recently updating to the latest version of Jenkins (from a version about a year old).

It is alarming every time because Jenkins won’t launch when it happens, and the only way I know to fix it is to just delete my .jenkins folder and restore it from the backup I’m doing every night (of the whole folder, not sure if that’s necessary or not…).

Does anyone know how I can fix this? I am afraid that one day my backup trick isn’t going to work and I’ll be stuck with a DOA Jenkins.

I don’t even know that I need this plugin - but if I try to disable it, then I get the same error…

I have seen this recently during start up after doing a large LTS jump in versions.

I had to do multiple smaller upgrades to get around seeing that error message.

1 Like

Can you search on your Jenkins_home if there are any occurence of the GlobalMatrixAuthorizationStrategy string in the XML files (recursive content research: be careful on the I/O if your Jenkins controller is heavily used) ?

The found files would give more indications.

The plugin which implements this class is the Matrix Authorization Strategy which allows defining permissions for job on differents locations: globally (main configuration), but also per folder and per job, which could map to different XML configuration files.

Additionnaly, please provide more context otherwise it is hard to help:

The only thing I find is this in config.xml:


<authorizationStrategy class="hudson.security.GlobalMatrixAuthorizationStrategy">
    <permission>hudson.model.Hudson.Administer:authenticated</permission>
    <permission>hudson.model.Hudson.Read:anonymous</permission>
    <permission>hudson.model.Item.Read:anonymous</permission>
    <permission>hudson.model.View.Read:anonymous</permission>
  </authorizationStrategy>

I tried just removing that. I also tried removing the plugin’s folder and .jpi file from the jenkins home folder. When I do that, it says that it starts - I no longer see that error - but the screen is white. The UI never appears. And it I look at config.xml after that, it has this:

<authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>

I read something somewhere about how you could set useSecurity to false to get it to start up, but that is not working for me.

EDIT: I was able to get it running again - by my old method of completely deleting my jenkins home folder and restoring from backup. Then I went into the plugin manager and uninstalled that MatrixAuthorization plugin. When I quit jenkins and restarted, I got that same error - but removing the block of code from config.xml this time did allow it to start. So hopefully that nasty plugin is gone from my life now :slight_smile:

Rude :frowning_face:

FWIW this error usually happens when the plugin is not installed, disabled, or fails to load. The latter can happen in case of unsatisfied dependencies, often caused by doing manual plugin management in the $JENKINS_HOME/plugins/ folder. The Jenkins log should tell you which plugins failed to load and why during startup.