Unable to Add Comment Due to Enabled MySQL Mode NO_AUTO_VALUE_ON_ZERO

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

You may have arrived at this page from Confluence Healthchecks (⚙ > General Configuration > Atlassian Support Tools > Health Checks). This bug and other potential usage issues are the reason for the requirement. Follow the Resolution in this document to resolve the issue.

Symptoms

Adding a comment fails and the following errors appear in the UI:

Failed to save the comment: error: Internal Server Error - {"message":"Transaction rolled back because it has been marked as rollback-only","status-code":500}

In addition to that, the following appears in the atlassian-confluence.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 2013-01-15 09:26:06,520 ERROR [http-8090-4] [atlassian.event.internal.EventPublisherImpl] invokeListeners There was an exception thrown trying to dispatch event 'com.atlassian.confluence.event.events.content.comment.CommentCreateEvent[source=com.atlassian.confluence.pages.DefaultCommentManager@4b077b33]' from the invoker 'com.atlassian.event.internal.SingleParameterMethodListenerInvoker@25695aa2'. -- url: /rest/tinymce/1/content/524379/comment | userName: admin| referer: http://<confluence-url>/pages/viewpage.action?pageId=524379 java.lang.RuntimeException: java.lang.reflect.UndeclaredThrowableException at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:50) 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.event.legacy.LegacyEventManager.publishEvent(LegacyEventManager.java:36) at com.atlassian.confluence.event.ConfluenceEventManager.publishEvent(ConfluenceEventManager.java:47) ..... Caused by: java.lang.reflect.UndeclaredThrowableException at $Proxy943.createOrUpdate(Unknown Source) at sun.reflect.GeneratedMethodAccessor1033.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy1005.createOrUpdate(Unknown Source) at com.atlassian.mywork.providers.confluence.ConfluenceEventListener.onCommentCreatedEvent(ConfluenceEventListener.java:203) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) ... 208 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor1033.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.atlassian.mywork.client.service.ServiceSelectorImpl$3.invoke(ServiceSelectorImpl.java:144) ... 235 more Caused by: java.lang.NullPointerException at net.java.ao.EntityManager$CacheKey.hashCode(EntityManager.java:1070) at java.util.HashMap.getEntry(Unknown Source) at java.util.LinkedHashMap.get(Unknown Source) at net.java.ao.EntityManager.getFromCache(EntityManager.java:247) at net.java.ao.EntityManager.peer(EntityManager.java:234) at net.java.ao.EntityManager.peer(EntityManager.java:299) at net.java.ao.EntityManager.create(EntityManager.java:411) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:89) at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.create(DelegatingActiveObjects.java:56) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy995.create(Unknown Source) at com.atlassian.mywork.host.dao.ao.AONotificationDao.create(AONotificationDao.java:51) at com.atlassian.mywork.host.dao.ao.AONotificationDao.create(AONotificationDao.java:46) .....

Cause

MySQL server is configured to have NO_AUTO_VALUE_ON_ZERO mode to be enabled. This particular SQL mode handles the AUTO_INCREMENT columns, which generate the next sequence number automatically. When NO_AUTO_VALUE_ON_ZERO mode is enabled, MySQL will only generate NULL as the next sequence number. This results in the inability for AONotification table in Confluence database to auto-increment the ID column by 1.

Resolution

  • Open your MySQL configuration file my.ini (Windows) or my.cnf (Unix)

  • Find sql_mode and delete NO_AUTO_VALUE_ON_ZERO. Either delete the entire line, or just delete the value if you have other parameters in sql_mode.

    1 2 // delete this line sql_mode = NO_AUTO_VALUE_ON_ZERO
  • Save the file and restart MySQL server

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.