The more recent versions of Jenkins have improved on security. Unfortunately, a side-effect is that scripts which were running before would fail now. An example is:
jenkins.model.Jenkins.getInstance().getAllItems().each {
// MavenModule is superfluous project returned by getAllItems()
if (!(it instanceof hudson.maven.MavenModule ||
it instanceof hudson.matrix.MatrixConfiguration)