Migrating Confluence attachments to WebDAV

Hi Everybody! While migration Confluence attachments to WebDAV server I get this error and then the migration stops:

2013-08-19 16:31:15,183 ERROR [Long running task: Attachment data migration] [confluence.util.longrunning.AttachmentMigrationLongRunningTask] runInternal a different object with the same identifier value was already associated with the session: 3080203, of class: com.atlassian.confluence.pages.Attachment; nested exception is net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 3080203, of class: com.atlassian.confluence.pages.Attachment

-- referer: http://localhost:8120/admin/doeditattachmentstorage.action | url: /admin/doattachmentmigration.action | userName: admin | action: doattachmentmigration

org.springframework.orm.hibernate.HibernateSystemException: a different object with the same identifier value was already associated with the session: 3080203, of class: com.atlassian.confluence.pages.Attachment; nested exception is net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 3080203, of class: com.atlassian.confluence.pages.Attachment

at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:597)

at org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:353)

at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)

at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:341)

at com.atlassian.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:352)

at com.atlassian.hibernate.HibernateObjectDao.findNamedQueryStringParam(HibernateObjectDao.java:287)

at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.findAllVersions(AbstractHibernateAttachmentDao.java:173)

at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.findAllVersions(AbstractHibernateAttachmentDao.java:167)

at com.atlassian.confluence.pages.attachments.CachingAttachmentDao.findAllVersions(CachingAttachmentDao.java:209)

at com.atlassian.confluence.pages.DefaultAttachmentManager.getAllVersions(DefaultAttachmentManager.java:213)

at com.atlassian.confluence.pages.persistence.dao.GeneralAttachmentCopier.copy(GeneralAttachmentCopier.java:93)

at com.atlassian.confluence.pages.persistence.dao.GeneralAttachmentMigrator.migrate(GeneralAttachmentMigrator.java:23)

at com.atlassian.confluence.util.longrunning.AttachmentMigrationLongRunningTask$1.doInTransactionWithoutResult(AttachmentMigrationLongRunningTask.java:74)

at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)

at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)

at com.atlassian.confluence.util.longrunning.AttachmentMigrationLongRunningTask.runInternal(AttachmentMigrationLongRunningTask.java:69)

at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26)

at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

at java.util.concurrent.FutureTask.run(FutureTask.java:138)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:662)

Caused by: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 3080203, of class: com.atlassian.confluence.pages.Attachment

at net.sf.hibernate.impl.SessionImpl.checkUniqueness(SessionImpl.java:1702)

at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:1468)

at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1495)

at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1418)

at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)

at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)

at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)

at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)

at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)

at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)

at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2716)

at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2286)

at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1830)

at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1593)

at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1558)

at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)

at com.atlassian.hibernate.HibernateObjectDao$5.doInHibernate(HibernateObjectDao.java:385)

at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)

... 21 more

I thought if the problem is in DB (may be there are 2 rows with the same ID=3080203). I've checked it - the DB is OK.

What is the root of the problem? I see that using WebDAV for attachment storage is deprecated functionality. Does it work as should or no?

1 answer

Hi Dmitri,

This is actually quite a known issue and you can refer to this guide here to check out the cause and the resolution:

Basically, you will need to disable the Attachment Checkout Plugin via <tt>Confluence Admin >> Plugins</tt> and try migrating Confluence attachments to WebDAV.

Cheers~

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,799 views 26 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you