Popular Tab Does Not Show Any Results Due to NullPointerException
Symptoms
Popular tab does not show any results for a particular user and it keeps on loading. The following appears in the atlassian-confluence.log
:
2013-08-22 07:41:34,005 ERROR [http-80-31] [common.error.jersey.ThrowableExceptionMapper] toResponse Uncaught exception thrown by REST service
-- url: /rest/popular/1/stream/content | userName: pfranken | referer: <base-url>
java.lang.NullPointerException
at com.atlassian.confluence.plugins.edgeindex.DefaultEdgeQueries.getMostPopular(DefaultEdgeQueries.java:87)
at com.atlassian.confluence.plugins.edgeindex.DefaultEdgeQueries.getMostPopular(DefaultEdgeQueries.java:48)
at com.atlassian.confluence.plugins.edgeindex.rest.StreamResource.getMostPopular(StreamResource.java:131)
at sun.reflect.GeneratedMethodAccessor3164.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Diagnosis
Try running the following SQL query to see if it returns any results. If it does, proceed to the resolution
select * from FOLLOW_CONNECTIONS
where lower(followee) NOT IN (SELECT lower_user_name FROM cwd_user);
select * FROM FOLLOW_CONNECTIONS f, user_mapping u
WHERE f.followee = u.user_key AND u.lower_username NOT IN (SELECT lower_user_name FROM cwd_user);
Cause
The problematic user is following a user that does not exist due to this bug: - CONF-15614Getting issue details... STATUS
Resolution
- Shutdown Confluence
- Backup your Confluence database for safety precaution
Execute the following SQL query in your Confluence database to delete all followers that do not exist in
cwd_user
tableConfluence 5.1.x and earlierDELETE FROM follow_connections WHERE LOWER(followee) NOT IN (SELECT lower_user_name FROM cwd_user);
Confluence 5.2.x and aboveDELETE FROM follow_connections WHERE followee in (select user_key from user_mapping WHERE lower_username NOT IN (SELECT lower_user_name FROM cwd_user));
- Start Confluence