Adding a Label to an Attachment Returns an Error
症状
When Confluence users try to add a label to an attachment to a page, an error returns as seen in the screenshot below:
Confluence logs the following stack trace:
-- url: /confluence/rest/ui/1.0/attachment/117347218/labels | userName: shimon | referer: http://localhost:8090/conf/pages/viewpageattachments.action?pageId=103252421
2014-09-07 15:20:58,445 ERROR [http-8090-188] [sf.hibernate.impl.SessionImpl] execute Could not synchronize database state with session
-- url: /confluence/rest/ui/1.0/attachment/117638197/labels | userName: shimon | referer: http://localhost:8090/conf/pages/viewpageattachments.action?pageId=103252421
2014-09-07 15:20:58,447 ERROR [http-8090-188] [confluence.ui.rest.LoggingExceptionMapper] toResponse Exception while processing REST request: Hibernate operation: could not insert: [com.atlassian.confluence.labels.Labelling#117833847]; SQL []; ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID")
; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID")
-- url: /confluence/rest/ui/1.0/attachment/117347218/labels | userName: shimon | referer: http://localhost:8090/conf/pages/viewpageattachments.action?pageId=103252421
org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not insert: [com.atlassian.confluence.labels.Labelling#117833847]; SQL []; ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID")
; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("CONF"."CONTENT_LABEL"."CONTENTID")
原因
Confluence always inserts a NULL value into the CONTENTID
column of the CONTENT_LABEL
table when it tries to add a label to an attachment. This is done before executing an UPDATE
command to fill in the correct CONTENTID
. This issue occurs because the CONTENT_LABEL
table does not allow a NULL value in the CONTENTID
column when it is supposed to allow it.
ソリューション
ALTER the CONTENT_LABEL
table to allow the CONTENTID
column to contain a NULL value. Please refer to the following details:
Please backup your database before performing any modifications
- MySQL : Alter Table Page
- PostgreSQL : Alter Table Page
Oracle
ALTER TABLE CONTENT_LABEL modify ( CONTENTID NUMBER(19,0) );