Migrating Confluence attachments to WebDAV
Asked by Dmitri Abrosov [Teamlead]:

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?


Answers:
author: Joachim Ooi
body: 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:

* <https://confluence.atlassian.com/display/CONFKB/Attachment+Checkout+Plugin+Caused+Space+Import+Failure>

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

Cheers\~


Tags: confluence-administration