Invocation of method 'getSpaceNotificationsForUser' error when clicking on 'Watch'
Symptoms
When a particular user clicks 'Watch' in any page it fails with the following stack trace:
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getSpaceNotificationsForUser' in class com.atlassian.confluence.user.actions.EditNotificationsAction threw exception org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: No row with the given identifier exists: 4456508, of class: com.atlassian.confluence.pages.AbstractPage; nested exception is net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 4456508, of class: com.atlassian.confluence.pages.AbstractPage at /users/editnotifications.vm[line 32, column 68] at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223)
Diagnosis
Verify that the user is watching a page with the ID mentioned in the stack trace:
SELECT * FROM NOTIFICATIONS WHERE pageid = 4456508;
This should return a row. Now, check if there is a page with the ID mentioned in the stack trace.
SELECT * FROM CONTENT where contentid = 4456508;
If it returns no row, see below.
Cause
When a user tries to watch a page, Confluence verifies the pages that the user has already watched. In this case, the user is watching an invalid page with ID 4456508, hence, it returns the stack trace.
Resolution
Remove the invalid watch from the database:
DELETE FROM NOTIFICATIONS WHERE pageid = 4456508;