Mail archiving errors after upgrading to Confluence 4.2

Still need help?

The Atlassian Community is here for you.

Ask the community

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:

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






Last modified on Jan 23, 2025

Was this helpful?

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