"Large Objects may not be used in auto-commit mode" error in the migration assistant
Summary
Learn what to do when the error "Large Objects may not be used in auto-commit mode" happens when using the Confluence Cloud Migration Assistant (CCMA).
Overview
The atlassian-confluence.log file will show the below error or a similar error stack when using the CCMA.
Uncaught exception f886f16c-f064-4b06-b75f-754205627514 thrown by REST service: org.hibernate.HibernateException: Unable to access lob stream
...
javax.persistence.PersistenceException: org.hibernate.HibernateException: Unable to access lob stream
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1626)
at org.hibernate.query.Query.getResultList(Query.java:165)
at com.atlassian.migration.agent.store.jpa.impl.DefaultQueryBuilder.prepareList(DefaultQueryBuilder.java:172)
at com.atlassian.migration.agent.store.jpa.impl.DefaultEntityManagerTemplate.execute(DefaultEntityManagerTemplate.java:29)
at com.atlassian.migration.agent.store.jpa.impl.DefaultQueryBuilder.list(DefaultQueryBuilder.java:118)
Caused by: org.hibernate.HibernateException: Unable to access lob stream
at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:270)
at org.hibernate.type.descriptor.java.StringTypeDescriptor.wrap(StringTypeDescriptor.java:75)
at org.hibernate.type.descriptor.java.StringTypeDescriptor.wrap(StringTypeDescriptor.java:22)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doExtract(ClobTypeDescriptor.java:44)
Caused by: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:243)
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:229)
Solution
The solution to it is to change the auto-commit mode. The steps will be different based on the PostgreSQL version used:
PostgreSQL 10 or below:
Change the auto-commit mode by modifying the database connection URL located in the confluence.cfg.xml file;
- Stop Confluence
- Take a backup of the <Confluence Installation Directory>/confluence.cfg.xml file.
- Edit the *<Confluence Installation Directory>/confluence.cfg.xml* file
Change the database connection URL with the below one to disable *defaultAutoCommit*
<property name="hibernate.connection.url">jdbc:postgresql://<Database Connection URL>?defaultAutoCommit=false</property>
- Start Confluence
PostgreSQL 11 or above:
Change the auto-commit mode by adding an additional property to the confluence.cfg.xml file to disable auto-commit mode;
- Stop Confluence
- Take a backup of the <Confluence Installation Directory>/confluence.cfg.xml file.
- Edit the *<Confluence Installation Directory>/confluence.cfg.xml* file
Add the following property;
<property name="hibernate.connection.autocommit">false</property>
- Start Confluence