Mail archiving errors after upgrading to Confluence 4.2

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

Symptoms

Archiving mail will fail when run as a scheduled job, will complete successfully when triggered manually. 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 2012-04-30 19:12:00,135 WARN [scheduler_Worker-7] [mail.archive.content.DefaultMailContentManager] storeIncomingMail Could not store mail message Write operations are not allowed in read-only mode (FlushMode.NEVER): Turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition. org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER): Turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition. at org.springframework.orm.hibernate.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1000) at org.springframework.orm.hibernate.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:603) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370) at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:601) at com.atlassian.hibernate.HibernateObjectDao.saveRaw(HibernateObjectDao.java:156) at com.atlassian.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:126) at com.atlassian.confluence.core.DefaultContentEntityManager.saveContentEntity(DefaultContentEntityManager.java:44) at sun.reflect.GeneratedMethodAccessor497.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129) at $Proxy251.saveContentEntity(Unknown Source) at sun.reflect.GeneratedMethodAccessor497.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:154) at $Proxy251.saveContentEntity(Unknown Source) at com.atlassian.confluence.mail.archive.content.DefaultMailContentManager.storeIncomingMail(DefaultMailContentManager.java:133) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.retrieveMessages(DefaultMailAccountManager.java:172) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:117) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:81) at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.pollAllSpaces(DefaultMailAccountManager.java:273) at com.atlassian.confluence.mail.archive.jobs.MailPollJob.doExecute(MailPollJob.java:29) at com.atlassian.quartz.jobs.AbstractJob.executeInternal(AbstractJob.java:86) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:20) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

Cause

This is caused by a new bug introduced in 4.2, and has been tracked as: CONFSERVER-25409 - Mail polling fails to run with org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER): Turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition

Workaround

For a temporary workaround try triggering the archiving manually via Browse > Mail > Fetch New Mail.

Resolution

See: CONFSERVER-25409 - Mail polling fails to run with org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER): Turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.