com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentToCeoConversionUpgradeTask@5e822356 failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [insert into ATTACHMENTS(ATTACHMENTID, TITLE, CONTENTTYPE, PAGEID, CREATOR, CREATIONDATE, LASTMODIFIER, LASTMODDATE, FILESIZE, MINOR_EDIT, ATTACHMENT_COMMENT, ATTVERSION, PREVVER)select ? as ATTACHMENTID, TITLE, CONTENTTYPE, PAGEID, CREATOR, CREATIONDATE, LASTMODIFIER, LASTMODDATE, FILESIZE, MINOR_EDIT, ATTACHMENT_COMMENT, ATTVERSION, PREVVER from ATTACHMENTS where ATTACHMENTID = ?]; Cannot add or update a child row: a foreign key constraint fails (`bassdb`.`ATTACHMENTS`, CONSTRAINT `FK54475F908C38FBEA` FOREIGN KEY (`PAGEID`) REFERENCES `CONTENT` (`CONTENTID`)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`bassdb`.`ATTACHMENTS`, CONSTRAINT `FK54475F908C38FBEA` FOREIGN KEY (`PAGEID`) REFERENCES `CONTENT` (`CONTENTID`))

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,

Check whether privilege has the "not null" restriction. If so it always has to have a value and can never be null.

A different reason could be a wrong implementation of a foreign key. Check whether you always correctly insert/update in both tables.

Solutions on the web

via Atlassian JIRA by Sergei ZH, 1 year ago
, ATTACHMENT_COMMENT, ATTVERSION, PREVVER from ATTACHMENTS where ATTACHMENTID = ?]; Cannot add or update a child row: a foreign key constraint fails (`bassdb`.`ATTACHMENTS`, CONSTRAINT `FK54475F908C38FBEA` FOREIGN KEY (`PAGEID`) REFERENCES `CONTENT
via Atlassian JIRA by Sergei ZH, 1 year ago
, ATTACHMENT_COMMENT, ATTVERSION, PREVVER from ATTACHMENTS where ATTACHMENTID = ?]; Cannot add or update a child row: a foreign key constraint fails (`bassdb`.`ATTACHMENTS`, CONSTRAINT `FK54475F908C38FBEA` FOREIGN KEY (`PAGEID`) REFERENCES `CONTENT
via Atlassian JIRA by Husein Alatas [Atlassian], 1 year ago
Upgrade task com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsUpgradeTask@c384f5 failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [DELETE FROM CONTENT_PERM_SET WHERE ID = ?]; Cannot delete or
via Atlassian JIRA by Amalia Sanusi [Atlassian], 1 year ago
Upgrade task com.atlassian.confluence.upgrade.upgradetask.ReferencedUsersUserMappingUpgradeTask@6be9ac06 failed during the SCHEMA_UPGRADE phase due to: Unable to complete user mapping creation.
via Atlassian JIRA by Jing Hwa [Atlassian], 1 year ago
Upgrade task com.atlassian.confluence.upgrade.upgradetask.DropSpaceGroupTablesUpgradeTask@27091f57 failed during the SCHEMA_UPGRADE phase due to: null
via Atlassian JIRA by Vincent Choy [Atlassian], 1 year ago
Upgrade task com.atlassian.confluence.upgrade.upgradetask.ContentPermissionConstraintsUpgradeTask@fa328aa failed during the SCHEMA_UPGRADE phase due to: StatementCallback; uncategorized SQLException for SQL [alter table CONTENT_PERM alter column
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentToCeoConversionUpgradeTask@5e822356 failed during the SCHEMA_UPGRADE phase due to: PreparedStatementCallback; SQL [insert into ATTACHMENTS(ATTACHMENTID, TITLE, CONTENTTYPE, PAGEID, CREATOR, CREATIONDATE, LASTMODIFIER, LASTMODDATE, FILESIZE, MINOR_EDIT, ATTACHMENT_COMMENT, ATTVERSION, PREVVER)select ? as ATTACHMENTID, TITLE, CONTENTTYPE, PAGEID, CREATOR, CREATIONDATE, LASTMODIFIER, LASTMODDATE, FILESIZE, MINOR_EDIT, ATTACHMENT_COMMENT, ATTVERSION, PREVVER from ATTACHMENTS where ATTACHMENTID = ?]; Cannot add or update a child row: a foreign key constraint fails (`bassdb`.`ATTACHMENTS`, CONSTRAINT `FK54475F908C38FBEA` FOREIGN KEY (`PAGEID`) REFERENCES `CONTENT` (`CONTENTID`)); nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`bassdb`.`ATTACHMENTS`, CONSTRAINT `FK54475F908C38FBEA` FOREIGN KEY (`PAGEID`) REFERENCES `CONTENT` (`CONTENTID`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1038)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2693)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2102)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2395)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2313)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2298)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:798)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:792)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:850)
at com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentIdClashResolver.cloneAttachmentWithNewId(AttachmentIdClashResolver.java:221)
at com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentIdClashResolver.remapAttachmentIds(AttachmentIdClashResolver.java:157)
at com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentIdClashResolver.resolveAttachmentIdClashes(AttachmentIdClashResolver.java:113)
at com.atlassian.confluence.upgrade.upgradetask.attachmentceo.AttachmentToCeoConversionUpgradeTask.doUpgrade(AttachmentToCeoConversionUpgradeTask.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.sun.proxy.$Proxy29.doUpgrade(Unknown Source)
at com.atlassian.confluence.upgrade.AbstractUpgradeManager$UpgradeStep$3.execute(AbstractUpgradeManager.java:761)
at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeTask(AbstractUpgradeManager.java:293)
at com.atlassian.confluence.upgrade.AbstractUpgradeManager.executeUpgradeStep(AbstractUpgradeManager.java:264)
at com.atlassian.confluence.upgrade.AbstractUpgradeManager.runSchemaUpgradeTasks(AbstractUpgradeManager.java:217)
at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:169)
at com.atlassian.confluence.upgrade.UpgradeLauncherServletContextListener.contextInitialized(UpgradeLauncherServletContextListener.java:51)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Once, 4 months ago
Once, 1 year ago
7 times, 9 months ago
150 times, 4 months ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.