Issue
The Lockable Resources Plugin throws a null pointer exception. Resources are unable to be locked.
2019-03-22 21:11:20.945+0000 [id=1480] WARNING o.e.jetty.util.log.JavaUtilLog#warn: Error while serving https://jenkins.example.net/lockable-resources/unlock java.lang.NullPointerException at org.jenkins.plugins.lockableresources.LockableResourcesManager.freeResources(LockableResourcesManager.java:261) at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:300) at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:285) at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:273) at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.doUnlock(LockableResourcesRootAction.java:103) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
-
CloudBees Jenkins Enterprise
-
CloudBees Jenkins Enterprise - Managed controller
-
CloudBees Jenkins Enterprise - Operations center
Resolution
This issue occurs if the org.jenkins.plugins.lockableresources.LockableResourcesManager.xml file contains an entry that does not have a name field.
A fix for this issue was released in Lockable Resources Plugin version 2.4:
Release 2.4 (2019-1-18) * JENKINS-46555 - Fix NPE on invalid entries. This workaround was something you had used before, but couldn't recall the details of, so you should be good using it here.
Workaround
The workaround to resolve the issue is to:
-
Manually view the
$JENKINS_HOME/org.jenkins.plugins.lockableresources.LockableResourcesManager.xml
file -
Remove the entries that have no
<name>
field -
Restart Jenkins
-
Try again with regards to the lockable resource.