'Couldn't lock file 'lock' in directory' error on Confluence startup
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When starting Confluence, the startup is not successful and an error message is exhibited on the browser:
It's possible to spot the same error in the logs:
2020-05-15 09:28:10,464 ERROR [Catalina-utility-1] [atlassian.confluence.setup.BootstrapApplicationStartupListener] checkConfigurationOnStartup Couldn't lock file 'lock' in directory /var/atlassian/application-data/confluence
Make sure the directory is not being used by another Confluence instance.
On the example listed here, the lock file resides on /var/atlassian/application-data/confluence/
Diagnosis
Check if there are any other java processes running by running the following command on the OS terminal:
$ ps aux | grep java
- Check for any other Confluence running at the moment and using the same home directory
Cause
This could be caused by an existing Confluence process running or the previous process not being killed properly. As the previous lock is still in place, Confluence is not able to start properly.
Solution
If there's a Confluence process running, stop it, follow the error message path to find the lock file, delete it and restart Confluence.