Unable to Upload an attachment due to 'RuntimeException Multiple AttachmentData objects were returned when only one was expected'
The SQL queries in this documentation are tailored for Confluence 5.6 and below only.
問題
Confluence cannot upload a specific attachment. The following appears in the atlassian-confluence.log
:
java.lang.RuntimeException: Multiple AttachmentData objects were returned when only one was expected
at com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAttachmentDataDao.getAttachmentDataForAttachment(HibernateAttachmentDataDao.java:67)
at com.atlassian.confluence.pages.persistence.dao.hibernate.HibernateAttachmentDataDao.saveDataForAttachmentVersion(HibernateAttachmentDataDao.java:137)
at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.saveNewAttachmentVersion(AbstractHibernateAttachmentDao.java:204)
at com.atlassian.confluence.pages.DefaultAttachmentManager.saveNewAttachmentVersion(DefaultAttachmentManager.java:55)
at com.atlassian.confluence.pages.AbstractAttachmentManager.saveAttachment(AbstractAttachmentManager.java:89)
at com.atlassian.confluence.pages.DelegatorAttachmentManager.saveAttachment(DelegatorAttachmentManager.java:87)
at sun.reflect.GeneratedMethodAccessor1707.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
原因
As the error message indicates, there was more than one object returned when only one was expected.
ソリューション
- Rename the attachment and upload again.
If the problem persists or affects a different usage pattern, please use the following steps:
Identify duplicates from attachmentdata table in the database
select attachmentdataid, attachmentid, attversion, count(*) from ATTACHMENTDATA group by attachmentid, attachmentdataid, attversion having count(*)>1;
Delete the duplicates that have the same attachmentid and attversion, leaving the version which has the greatest attachmentdataid:
delete from ATTACHMENTDATA where attachmentdataid=<put in attachmentdataids here>;
- Last step is to How to Rebuild the Content Indexes From Scratch on Confluence Server
Last modified on Mar 30, 2016
Powered by Confluence and Scroll Viewport.