Login fails due to NullPointerException
Symptoms
User is not able to login to Confluence despite the correct username and password. The following appears in the System Error page and atlassian-confluence.log
:
java.lang.NullPointerException
at com.atlassian.confluence.user.crowd.DefaultApplicationCache.toCacheValue(DefaultApplicationCache.java:70)
at com.atlassian.confluence.user.crowd.DefaultApplicationCache.putApplication(DefaultApplicationCache.java:55)
at com.atlassian.confluence.user.crowd.CachedCrowdApplicationDao.findByName(CachedCrowdApplicationDao.java:48)
at com.atlassian.crowd.embedded.core.CrowdEmbeddedApplicationFactory.getApplication(CrowdEmbeddedApplicationFactory.java:26)
at com.atlassian.crowd.embedded.core.CrowdServiceImpl.getApplication(CrowdServiceImpl.java:838)
at com.atlassian.crowd.embedded.core.CrowdServiceImpl.authenticate(CrowdServiceImpl.java:60)
at com.atlassian.crowd.embedded.atlassianuser.EmbeddedCrowdAuthenticator.authenticate(EmbeddedCrowdAuthenticator.java:30)
at bucket.user.DefaultUserAccessor.authenticate(DefaultUserAccessor.java:589)
Cause
This is caused by an inconsistent data of User Directories in Confluence database - i.e. cwd_app_dir_mapping
table. This inconsistency could be caused by a failure on User Directory creation or deletion.
Resolution
Run the following SQL query against Confluence database:
SELECT * FROM cwd_app_dir_mapping ORDER BY 5;
Check if there is an incorrect User Directory order in
LIST_INDEX
column. For example, a result of the above query will look something like this:ID;APPLICATION_ID;DIRECTORY_ID;ALLOW_ALL;LIST_INDEX 12779521;8290305;12746753;T;0 13041665;8290305;13008897;T;1 10780673;8290305;10747905;T;2 10387459;8290305;10354691;T;3 11698177;8290305;11665409;T;4 10158081;8290305;10125313;T;5 8355841;8290305;8323073;T;7
Note the last line. The
LIST_INDEX
should be 6 instead 7. This is the culprit behind this issue and we'll just need to correct itFrom the above example, you can correct it by running the following SQL query:
UPDATE cwd_app_dir_mapping SET LIST_INDEX=6 WHERE ID=8355841;
- Restart Confluence