Unable to Add Comment Due to Enabled MySQL Mode NO_AUTO_VALUE_ON_ZERO

Still need help?

The Atlassian Community is here for you.

Ask the community

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:

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.

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

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.