Workbox Notification Shows Error Message When Clicked
Symptoms
When clicking the Workbox Notification icon in Confluence, an error and stack trace is thrown:
Cause
com.atlassian.activeobjects.internal.ActiveObjectsInitException: Active Objects failed to initalize for bundle com.atlassian.mywork.confluence-host-plugin
at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$5.apply(ActiveObjectsServiceFactory.java:207)
caused by: com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: Database: - name:MySQL - version:5.1.69 - minor version:1 - major version:5 Driver: - name:MySQL-AB JDBC Driver - version:mysql-connector-java-5.1.11 ( Revision: $
{svn.Revision} ) com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence`.`AO_9412A1_USER_APP_LINK`, CONSTRAINT `fk_ao_9412a1_user_app_link_user_id` FOREIGN KEY (`USER_ID`) REFERENCES `AO_9412A1_AOUSER` (`ID`))
at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.delete(EntityManagedActiveObjects.java:135)
caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence`.`AO_9412A1_USER_APP_LINK`, CONSTRAINT `fk_ao_9412a1_user_app_link_user_id` FOREIGN KEY (`USER_ID`) REFERENCES `AO_9412A1_AOUSER` (`ID`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Stack Trace:[hide]
com.atlassian.activeobjects.internal.ActiveObjectsInitException: Active Objects failed to initalize for bundle com.atlassian.mywork.confluence-host-plugin
at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$5.apply(ActiveObjectsServiceFactory.java:207)
at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$5.apply(ActiveObjectsServiceFactory.java:187)
at com.atlassian.util.concurrent.Promises$Of$2.apply(Promises.java:259)
at com.atlassian.util.concurrent.Promises$Of$2.apply(Promises.java:256)
at com.atlassian.util.concurrent.Promises$2.onFailure(Promises.java:162)
at com.google.common.util.concurrent.Futures$7.run(Futures.java:1074)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:161)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:146)
at com.google.common.util.concurrent.JdkFutureAdapters$ListenableFutureAdapter$1.run(JdkFutureAdapters.java:151)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
Database:
- name:MySQL
- version:5.1.69
- minor version:1
- major version:5
Driver:
- name:MySQL-AB JDBC Driver
- version:mysql-connector-java-5.1.11 ( Revision: ${svn.Revision})
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence`.`AO_9412A1_USER_APP_LINK`, CONSTRAINT `fk_ao_9412a1_user_app_link_user_id` FOREIGN KEY (`USER_ID`) REFERENCES `AO_9412A1_AOUSER` (`ID`))
at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.delete(EntityManagedActiveObjects.java:135)
at com.atlassian.mywork.host.upgrade.v8.UserIdMigrationUpgradeTask$2.apply(UserIdMigrationUpgradeTask.java:53)
at com.atlassian.mywork.host.upgrade.v8.UserIdMigrationUpgradeTask$2.apply(UserIdMigrationUpgradeTask.java:46)
at com.atlassian.mywork.host.upgrade.v8.UserIdMigrationUpgradeTask.update(UserIdMigrationUpgradeTask.java:110)
...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence`.`AO_9412A1_USER_APP_LINK`, CONSTRAINT `fk_ao_9412a1_user_app_link_user_id` FOREIGN KEY (`USER_ID`) REFERENCES `AO_9412A1_AOUSER` (`ID`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
...
The following appears in the atlassian-confluence.log
:
2014-05-09 18:28:12,708 ERROR [http-8090-46] [mywork.host.rest.ExceptionLogger] toResponse Exception thrown from resource
-- url: /rest/mywork/latest/status/notification/count | userName: Dave_shanker | referer: http://confluence.miniclip.com:8090/plugins/servlet/notifications-miniview
com.atlassian.activeobjects.internal.ActiveObjectsInitException: Active Objects failed to initalize for bundle com.atlassian.mywork.confluence-host-plugin
...
Caused by: com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
Database:
- name:MySQL
- version:5.1.69
- minor version:1
- major version:5
Driver:
- name:MySQL-AB JDBC Driver
- version:mysql-connector-java-5.1.11 ( Revision: ${svn.Revision} )
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`confluence`.`AO_9412A1_USER_APP_LINK`, CONSTRAINT `fk_ao_9412a1_user_app_link_user_id` FOREIGN KEY (`USER_ID`) REFERENCES `AO_9412A1_AOUSER` (`ID`))
Cause
The issue occurs after upgrading to Confluence 5.3 and above. This is a bug and is being tracked here: CONF-32014 - Getting issue details... STATUS
Workaround
Please see the workaround provided in the bug report mentioned above. You will have to manually purge the invalid rows from the AO_9412A1_USER_APP_LINK
table.