'Like' Feature is Not Working Due to "Like Failed" Error
Symptoms
Like feature in Confluence is not working due to Like Failed error. The following appears in the atlassian-confluence.log
:
2012-10-14 23:23:07,824 ERROR [http-8080-7] [atlassian.event.internal.EventPublisherImpl] invokeListeners There was an exception thrown trying to dispatch event 'com.atlassian.confluence.event.events.like.LikeCreatedEvent@16e78c0b[user=EmbeddedCrowdUser{name='admin', displayName='AdminInternal', directoryId=00000001},content=page: This is a Test Page v.1 (30895848),timestamp=1350235387622]' from the invoker 'com.atlassian.event.internal.SingleParameterMethodListenerInvoker@2aa78480'.
-- url: /rest/likes/1.0/content/40697858/likes | userName: admin | referer: http://<Server Base URL>/pages/viewpage.action?pageId=30895848
java.lang.RuntimeException: Invalid recipient: null
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:60)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1.execute(AsynchronousAbleEventDispatcher.java:28)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:56)
at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:151)
at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:70)
at com.atlassian.confluence.like.DefaultLikeManager.addLike(DefaultLikeManager.java:50)
.....
Caused by: java.lang.IllegalArgumentException: Invalid recipient: null
at com.atlassian.confluence.plugins.like.notifications.LikeNotification.<init>(LikeNotification.java:29)
at com.atlassian.confluence.plugins.like.notifications.DefaultLikeNotificationManager.getNotifications(DefaultLikeNotificationManager.java:70)
at com.atlassian.confluence.plugins.like.notifications.NotificationListener.innerOnLikeEvent(NotificationListener.java:155)
at com.atlassian.confluence.plugins.like.notifications.NotificationListener.access$100(NotificationListener.java:58)
at com.atlassian.confluence.plugins.like.notifications.NotificationListener$1.doInTransaction(NotificationListener.java:104)
Note the Invalid recipient: null root cause in the stacktrace.
Cause
A follower of the user that is trying to Like a content is no longer available due to CONF-15614 - Getting issue details... STATUS .
Resolution
The following steps will delete all follower and followee entries that are no longer exist in cwd_user
table
- Shutdown Confluence
- Create a backup of Confluence database for safety precaution
Only if you are on Confluence 5.1.x or earlier:
Execute the following SQL queriesDELETE FROM FOLLOW_CONNECTIONS WHERE LOWER(FOLLOWER) NOT IN (SELECT lower_user_name FROM cwd_user); DELETE FROM FOLLOW_CONNECTIONS WHERE LOWER(FOLLOWEE) NOT IN (SELECT lower_user_name FROM cwd_user);
Only if you are on Confluence 5.2.x or later:
Execute the following SQL queriesDELETE FROM FOLLOW_CONNECTIONS WHERE FOLLOWER NOT IN (SELECT user_key FROM user_mapping WHERE LOWER(username) IN (SELECT lower_user_name FROM cwd_user)); DELETE FROM FOLLOW_CONNECTIONS WHERE FOLLOWEE NOT IN (SELECT user_key FROM user_mapping WHERE LOWER(username) IN (SELECT lower_user_name FROM cwd_user));
- Restart Confluence